Jitendra, Hi, my original post was not incorrect. I am actually trying to make children of a viewstack visible using a tab navigator, however the tab navigator is not a parent of the viewstack components. It is a parent of two other components within a separate Viewstack... creating a click event for the tab navigator does not work. A click event works when tied to the the children of the tab navigator, but doesn't make the interface work.
ie... here is code with click event tied to tab nav (which does not work)... import mx.events.FlexEvent; private function showPanel():void { if (tbNav.selectedChild==Panel1) { vwStk.selectedChild=pn1; } else { vwStk.selectedChild=pn2; } } ]]> </mx:Script> <mx:TabNavigator id="tbNav" x="100" y="19" width="350"> <mx:Panel id="Panel1" label="Panel1" click="{showPanel()}" height="40%" width="40%" > <mx:Label text="Panel1" /> </mx:Panel> <mx:Panel id="Panel2" label="Panel2" click="{showPanel()}" height="40%" width="40%"> <mx:Label text="Panel2" /> </mx:Panel> </mx:TabNavigator> <mx:ViewStack id="vwStk" x="100" y="154" height="40%" width="348"> <mx:Panel id="pn1" label="Panel1"> <mx:Label text="panel1"/> </mx:Panel> <mx:Panel id="pn2" label="Panel2"> <mx:Label text="panel2"/> </mx:Panel> </mx:ViewStack> <!-- <comp:myPanel1 id="pn1"/> <comp:myPanel2 id="pn2"/> --> </mx:Application> I suspect I will need to create some Listeners and Handlers, but I am not too good at understanding how to do that on my own, can you provide any guidance? Thanks !! Craig --- In flexcoders@yahoogroups.com, jitendra jain <[EMAIL PROTECTED]> wrote: > > instead of vwChart.selectedIndex=0 make it vwchart.selectedChild=lgch . It will work > > > Thanks, > > with Regards, > Jitendra Jain > Software Engineer > 91-9979960798 > > > > ----- Original Message ---- > From: Craig <[EMAIL PROTECTED]> > To: flexcoders@yahoogroups.com > Sent: Saturday, June 28, 2008 10:00:53 AM > Subject: [flexcoders] Help with ViewStack Event Listeners for Custom Components > > > My Viewstack does not make custom components active (they do not show > up with simple functions like this one... > > vwChrt.selectedinde x=0; > > vwChrt.selectedinde x=1; > > I suspect I need to add Event Handlers, and would like some guidance. > > My MXML code looks like this (shortened) - A viewstack surrounding two > custom components (panels) > > <mx:ViewStack id="vwChrt" > creationPolicy= "queued" > > > <mx:Panel id="lgCh" label="Long" > width="100%" height="100% "> > <comp:Charts id="Chart" > creationPolicy= "queued"> > </comp:Charts> > </mx:Panel> > > <mx:Panel id="shCh" title="Short" > width="100%" height="100% " > > <comp:ShortsChrt id="ShortChart" > creationPolicy= "queued"> > </comp:ShortsChrt> > </mx:Panel> > > </mx:ViewStack> > > I am not sure how to use the following event listeners. > > vwChrt.getChildAt( 0).addEventListe ner(FlexEvent. CREATION_ COMPLETE, > getLong); > > vwChrt.getChildAt( 1).addEventListe ner(FlexEvent. CREATION_ COMPLETE, > getShort); > > Can anyone offer any advice? > Thank you in advance for any help. > Craig >