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

    AS: Accessing Components inside Components

    lkenney2

      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();
           nc.connect(null);
           ns = new NetStream(nc);
           ns.play(vidSource);
           ns.client = nsClient;
           ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);
           
           video = new Video();
           video.attachNetStream(ns);
           uic.addChild(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:TabNavigator>  
          <mx:Button click="VBox(tb.getChildAt(0)).setStyle('backgroundColor', 0x0000FF);"/>
          </mx:Application>
          

           

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


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          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?