Careful however, by putting creationPolicy to "all" you will slow down the startup time of your app because it will have to create everything on every view, including the ones currently not displayed. Now in your sample app below this wont be visible, but in a larger app this will become apparent. Dimitrios Gianninas RIA Developer Optimal Payments Inc.
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Stembert Olivier (BIL) Sent: Monday, January 15, 2007 2:06 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Problem with viewstack in Flex 2.0 ActionScript not search element by id. 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of j_hora Sent: Sunday, January 14, 2007 2:45 PM To: flexcoders@yahoogroups.com 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. --------------------- -- WARNING ------- This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. AVIS IMPORTANT -------------- Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.