相邻NavigatorContent中组的空引用

Thi*_*Dev 1 apache-flex flash actionscript-3

我在MXML中有一个带NavigatorContent的TabNavigator.在第一个NavigatorContent里面我有一个带有一个id="canvas"; 我在这里加载一个SWFLoader.在下一个NavigatorContent里面,我有另一个组id="sheetcanvas"; 我想在这里加载一个SWFLoader.问题是,当我这样做时,我在sheetcanvasid 上得到错误#1009 null引用.

如果我把同一个组放在其他任何地方它没有空引用!

当动态加载到存在于Accordion的第二个NavigatorContent中的第二个组时,也会发生相同的错误.我做错了什么或有错误吗?

<mx:TabNavigator id="tabs" width="650" height="100%">
        <s:NavigatorContent width="100%" height="100%" label="Tab 1">
            <mx:DividedBox top="3" bottom="3" right="3" left="3" direction="vertical" width="100%" height="100%">

                <s:BorderContainer x="28" y="10" width="100%" height="100%">
                    <s:TextArea y="6" width="120" height="24" borderVisible="false"
                                text="{selectedNode.@label}"/>
                    <s:CheckBox y="6" right="10" label="Show Grid" selected="true"/>
                    <s:Scroller x="8" y="30" width="99%" height="90%" horizontalCenter="0">
                        <s:Group>
                            <s:Group id="canvas"/>

                        </s:Group>
                    </s:Scroller>
                </s:BorderContainer>
                <flexmd:FileEditor id="edit" width="100%" height="100%"
                                   enablePrint="true" enableSyntaxColoring="true" savePhp="/FileEditor/php/save.php"
                                   staticDemo="false"
                                   chromeColor="0xDCDCDC"
                                   />

            </mx:DividedBox>    
        </s:NavigatorContent>
        <s:NavigatorContent width="100%" height="100%" label="Tab 2">
            <mx:DividedBox top="3" bottom="3" right="3" left="3" direction="vertical" width="100%" height="100%">
                <s:BorderContainer x="28" y="10" width="100%" height="325">
                    <s:Scroller x="8" y="30" width="99%" height="100%" horizontalCenter="0">
                        <s:Group>
                            <s:Group id="scanvas"/>
                        </s:Group>
                    </s:Scroller>
                </s:BorderContainer>
            </mx:DividedBox>    
        </s:NavigatorContent>   
    </mx:TabNavigator>
Run Code Online (Sandbox Code Playgroud)

bum*_*ack 6

这不是一个错误.某些容器(如TabNavigator或ViewStack)在显示之前不会初始化其子元素.如果您需要从一开始就访问(隐藏)子元素,请将该creationPolicy属性设置为all.

例如. <mx:TabNavigator id="tabs" width="650" height="100%" creationPolicy="all">

以下是有关creationPolicy的更多信息.