1 Reply Latest reply on Feb 3, 2010 10:00 PM by Flex harUI

    Dynamically set a dataProvider to a HorizontalList?

    trainsimple

      I was hoping someone might be able to help. I'm building a TabNavigator, and each tab has a HorizontalList in it. I want to loop through an Array, and populate the HorizontalList with data after I make a Tab visible. I can make the tab visible, but don't know how to access the HorizontalList within the HBox to assign it a dataprovider.

       

      Here's mxml:

       

       

      <mx:HBox id="tab0" height="120" horizontalAlign="center" horizontalScrollPolicy="off" verticalScrollPolicy="off">

      <mx:HorizontalList id="hl0" width="580" height="120" itemRenderer="itemRenderers.Tiles" change="changeHandler(event)" backgroundAlpha="0" borderThickness="0"/>

      </mx:HBox>

      <mx:HBox id="tab1" height="120" horizontalAlign="center" horizontalScrollPolicy="off" verticalScrollPolicy="off">

      <mx:HorizontalList id="hl1" width="580" height="120" itemRenderer="itemRenderers.Tiles" change="changeHandler(event)" backgroundAlpha="0" borderThickness="0"/> ....

       

      and Here's what I have for AS

       

       

      private function addTabs():void

      {

      for(var i:int=0; webcastTypesNamesArray.length; i++)

      {

      var showTab = this["tabBar"].getChildAt(i+1);

      showTab.visible = true;

      showTab.width = 80;

      showTab.label = webcastTypesNamesArray[i];

       

      var populateHL = "hl" + String(i);

      populateHL.dataProvider = videoData[i];

      }

      }

       

       

       

       

      there are several ArrayCollection objects called videoData0, videoData1, etc.