1 Reply Latest reply on Jul 20, 2009 11:59 PM by leybniz

    No dataProvider for ViewStack?

    ZBethel

      Greetings,

       

      I'm designing an App that has a ViewStack with four identical custom components, each with it's own internal data that the user can set via checkboxes.  I'd really like to break away from having to do this:

       

      <mx:ViewStack ...>

          <ns1:OptionsPanel ... id="pref1">

          <ns2:OptionsPanel ... id="pref2">

          <ns3:OptionsPanel ... id="pref3">

          <ns4:OptionsPanel ... id="pref4">

      </mx:ViewStack>

       

      This just makes things really ugly and it restricts the number of views I can have to a hardcoded amount.  I can't find a dataProvider method that I could use to bind an array of OptionsPanel objects to, and this is what I'd really like to be able to do.

       

      Is there a way around this?  Or am I stuck having to hardcode it.

       

      Thanks,

      Zach.

        • 1. Re: No dataProvider for ViewStack?
          leybniz Level 4

          There is a way, you could go with actionScript routine to fill ViewStack from the loop of 4 items for instance, loop seems like less hardcoded

           

          for each (var op:OptionsPanel in yourDesiredDataProvider)

               viewStack.addChild(op);

           

          or even better, you could build your own ViewStack descendant having dataProvider property

           

          If you feel this message answers your question or helps, please mark it respectively