Jan, By default, the View Stack control's children are not created until they are selected. Change the creationPolicy attribute of the View Stack to "all". Regards, Olivier
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of j_hora Sent: Sunday, January 14, 2007 2:45 PM To: [email protected] Subject: [flexcoders] Problem with viewstack in Flex 2.0 ActionScript not search element by id. Hallo, i start with Flex2 and have this problem. ActionScript not search Label by id in the second Canvas in ViewStack. Application start with error TypeError: Error #1009: Cannot access a property or method of a null object reference. Id "labela" search OK, but "labelb" is for the function "invisible". What's wrong? My application: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute" creationComplete="start();"> <mx:Script> <![CDATA[ public function start():void { labela.text = "new text A"; labelb.text = "new text B"; } ]]> </mx:Script> <mx:TabBar height="30" width="200" id="tab_menu" dataProvider="stack1" > </mx:TabBar> <mx:ViewStack x="0" y="40" width="250" height="100" borderStyle="solid" id="stack1"> <mx:Canvas label="aaa"> <mx:Label width="200" id="labela" text="old text A"/> </mx:Canvas> <mx:Canvas label="bbb"> <mx:Label width="200" id="labelb" text="old text B"/> </mx:Canvas> </mx:ViewStack> </mx:Application> Very thanks for help Jan Hora --------------------- An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. --------------------- --------------------- An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. ---------------------

