3 Replies Latest reply on Nov 7, 2008 6:45 AM by rmorgan

    dynamic states

    rmorgan Level 1
      I am trying to create dynamic states. I am not sure if I am going about it the correct way or not but I am certainly open to more efficient ways of doing this. The problem as far as I can tell is the click attribute in the radio button. I have this for a starting point:

      <mx:Panel x="26" y="10" layout="absolute" id="affiliatepanel" height="200" title="Select Affiliation">
      <mx:VBox y="10" height="140" width="173" x="10" id="vbox1">
      <mx:RadioButtonGroup id="affiliation" />
      <mx:Repeater id="rp" dataProvider="{acArtists}">
      <mx:RadioButton label="{rp.currentItem.grouptype}" groupName="affiliation" click="currentState='{rp.currentItem.grouptype_id}+SelectState'"/>

      The starting point seems to do fine, except for calling the appropriate state. At the moment I have a total of 5 different states with different options depending on which radio button is selected from the starting point.
        • 1. Re: dynamic states
          rmorgan Level 1
          Any ideas?
          • 2. dynamic states
            Gregory Lafrance Level 6
            I just solved a similar problem for someone who wanted to use a Repeater to create multiple VideoDisplay controls, each with its own set of Play, Stop, Pause buttons.

            Create a component with one radio button, and then create several instances of the component.

            See this post on the VideoDisplay issue and you might be able to use some of the code.

            Multiple VideoDisplay Controls
            • 3. dynamic states
              rmorgan Level 1
              I looked at your suggestion, but being a newbie I could not make anything out of it. The problem I seem to be having is getting an undefined error:

              Main Thread (Suspended: ArgumentError: Undefined state '{rp.currentItem.grouptype}'.)
              mx.core::UIComponent/set currentState

              It does not seem to be able to resolve the variable in the currentState property but it does resolve in the label. I have changed the code a little since the original post to this:

              <mx:RadioButton label="{rp.currentItem.grouptype}" groupName="affiliation" click="currentState='{rp.currentItem.grouptype}'"/>