Hi all. I tried to do that: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" currentState="partview" width="100%" height="100%"> <mx:Script> <![CDATA[ private var cp:Panel private function onCopyClick(event:MouseEvent):void { cp=pnl; application.setCurrentState('fullview') fullc.addChild(cp); } private function onCopyClick2(event:MouseEvent):void { trace(playout+"|"+cp) playout.addChild(cp); if (fullc.getChildren().length>0) { fullc.removeAllChildren(); } application.setCurrentState('partview') } ]]> </mx:Script> <mx:states> <mx:State name="partview"> <mx:AddChild position="lastChild"> <mx:VBox id="playout" x="32" y="88" height="351" width="287"> <mx:Panel id="pnl" width="100%" height="100%" layout="absolute"> </mx:Panel> </mx:VBox> </mx:AddChild> </mx:State> <mx:State name="fullview"> <mx:AddChild position="lastChild"> <mx:VBox id="fullc" x="0" y="58" width="100%" height="100%"> </mx:VBox> </mx:AddChild> </mx:State> </mx:states> <mx:ApplicationControlBar x="0" y="0" width="100%" height="50"> <mx:Button label="Button1" click="onCopyClick(event)"/> <mx:Button label="Button2" click="onCopyClick2(event)"/> </mx:ApplicationControlBar> </mx:Application>
but I got error with RangeError: Error #2006: The supplied index is out of bounds. What the reason?

