附加的代码示例(伪代码)编译,但抛出此运行时错误:
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>
有什么方法可以让它工作而不必调用函数来设置 selectedChild?
谢谢。