Thanks. I knew that! I need more sleep Sent via BlackBerry from T-Mobile -----Original Message----- From: "Dealy, Brian" <[EMAIL PROTECTED]>
Date: Sun, 3 Feb 2008 12:34:58 To:<flexcoders@yahoogroups.com> Subject: RE: [flexcoders] Re: Object is Null? How can it be if it's a component in main.mxml. No access Viewstack’s children index is zero based, so you need to start at zero and go to two > if(indexHit == 0){ > Application.application.com1.getData(); > }else if(indexHit==1){ > Application.application.com2.getData(); > }else if(indexHit==2){ > //THIS FAILS > Application.application.com3.getData(); > }else{ > //nothing > } I hope this helps! regards, brian Brian Dealy Vice President - Technology SAIC Technical Fellow Science Application International Corp. San Diego, CA From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Damien Legros Sent: Sunday, February 03, 2008 3:45 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Object is Null? How can it be if it's a component in main.mxml. No access Check the viewstack creationPolicy property :) --- In [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com, "phipzkillah" <[EMAIL PROTECTED]> wrote: > > I have a toggle bar that's data provider is a viewstack. > When I click on the toggle bar an event is dispatched that my controller > is listening for. > > My controller can access com1, com2, but always gives me a null pointer > exception on com3. > All components are identical. > > I just wrote this off the top of my head. So syntax might be off a bit > and I only included the core functionality stripped down to demonstrate > my issue. > > Any thoughts? > > > Main.mxml > //script > import CustomClass(); > > protected var controller:CustomClass; > private function init():void{ > controller = new CustomClass(); > } > > //body > <togglebar click="controller.doSomething(event)" dataprovider="vs1"/> > > <viewstack id="vs1"> > <com1: id="com1"/> > <com2: id="com2"/> > <com3: id="com3"/> > </viewstack> > > CustomClass.as > //Controller > > public function doSomething(event:ItemClickEvent):void{ > var indexHit:int = event.index; > if(indexHit == 1){ > Application.application.com1.getData(); > }else if(indexHit==2){ > Application.application.com2.getData(); > }else if(indexHit==3){ > //THIS FAILS > Application.application.com3.getData(); > }else{ > //nothing > } > } > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/