The attached code example (pseudo code) compiles, but throws this Run-Time Error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/getChildIndex()
at mx.core::Container/getChildIndex()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2409]
at mx.containers::ViewStack/set selectedChild()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\ViewStack.as:557]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
[Bindable]
private var targetViewName:String = "content";
]]>
</mx:Script>
<mx:ViewStack id="viewStack" width="100%" height="100%"
selectedChild="{Container(viewStack.getChildByName(targetViewName))}">
<mx:Panel id="welcome" width="100%" height="100%" />
<mx:Panel id="content" width="100%" height="100%" />
</mx:ViewStack>
</mx:Application>
Is there some way I can get this to work without having to call a function to set the selectedChild?
Thanks.