That is very possible. You may like to look at calllater to run that code.

--- In flexcoders@yahoogroups.com, "advancedonsite" <nos...@...> wrote:
>
> If I put in an Alert statement before the 
> mainviewstack.selectedChild = 
> Container(mainviewstack.getChildByName(selectedno...@hidden));
> then everything works fine ?
> It's like the viewstack is not created in time but adding the alert slows it 
> down and allows it to be created, very weird.
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "advancedonsite" <nospam@> wrote:
> >
> > Let me give more details... Sometimes the viewstack shows sometimes it 
> > throws the error even on the same viewstack? its like something is not 
> > rendered in time or such?
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "advancedonsite" <nospam@> wrote:
> > >
> > > I've been using this code to choose a viewstack based on name of the 
> > > canvas ID... and it works but as the tree grew a bit larger I've noticed 
> > > that certain items throw an error of ReferenceError: Error #1065: 
> > > Variable  is not defined.
> > > getDefinitionByName()
> > > 
> > > ===========================================
> > > 
> > >  // Event handler for the Tree control change event.
> > >             public function treeChanged(event:Event):void {
> > >                
> > >                 selectedNode=Tree(event.target).selectedItem as XML;
> > >                 trace(selectedno...@hidden);
> > >                           mainviewstack.selectedChild = 
> > > Container(mainviewstack.getChildByName(selectedno...@hidden));
> > >                           
> > >             }
> > > 
> > > 
> > > 
> > > <mx:XMLList id="treeData">
> > >         <root label="Root Tree">
> > >             <main label="Announcements" hidden="announcements">
> > >                 <view label="Add"  hidden="announcements_add"/>
> > >                 <view label="Remove"  hidden="announcements_remove"/>
> > >             </main>
> > >             <main label="Stations" hidden="stations">
> > >                 <view label="Information" hidden="stations_information"/>
> > > 
> > > 
> > > 
> > > <mx:Tree id="RootTree" width="15%" height="100%" labelField="@label"
> > >                 showRoot="false" dataProvider="{treeData}" 
> > > change="treeChanged(event)"/>
> > >             <mx:ViewStack id="mainviewstack" width="85%" height="100%">
> > >               <mx:Canvas backgroundColor="#FFFFFF" id="announcements">
> > >                 <mx:Text text="TEST"
> > >                     fontWeight="bold"
> > >                     paddingTop="10" paddingLeft="10" />
> > >               </mx:Canvas>
> > >                     <mx:Canvas backgroundColor="#FFFFCC" 
> > > id="announcements_add">
> > >                 <mx:Text text="This is test viewstack"
> > >                     fontWeight="bold"
> > >                     paddingTop="10" paddingLeft="10" />
> > >               </mx:Canvas>
> > >
> >
>


Reply via email to