2 Replies Latest reply on Jan 13, 2010 10:28 AM by lkenney2

    AS: Accessing Components inside Components


      I have a UIComponent in flex that worked when it straight on th application. However, I want my UIComponent in a TabNavigator. I'm using actionScript to add the video to the UIComponent uic:


      var nsClient:Object = {};
           nsClient.onMetaData = function(metadata:Object):void{
                videoLength  = metadata.duration;
           nc = new NetConnection();
           ns = new NetStream(nc);
           ns.client = nsClient;
           ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);
           video = new Video();


      How can I change the actionScript to access the UIComponent uic now that is inside the TabNavigator?

        • 1. Re: AS: Accessing Components inside Components
          Gregory Lafrance Level 6

          This code should answer you question:


          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
          <mx:TabNavigator id="tb">
            <mx:VBox width="100" height="100" label="Blue"/>
          <mx:Button click="VBox(tb.getChildAt(0)).setStyle('backgroundColor', 0x0000FF);"/>


          If this post answers your question or helps, please mark it as such.

          Greg Lafrance - Flex 2 and 3 ACE certified


          Flex / AIR Development, Training, and Support Services

          • 2. Re: AS: Accessing Components inside Components
            lkenney2 Level 1






            No, that didn't work. I'm trying to access a component in the nav content, so the progression looks like this:


            TabNavigator > NavigatorContent > UIComponent


            Any ideas?