2 Replies Latest reply on Nov 5, 2006 12:44 PM by Saintcorp

    Change a STATE depending in a radio button

    Saintcorp
      HI everyone.

      I need to do this little thing, but is have been a real pain in the neck.

      I have a radio buttons and depending in wich selection is pressed, the state the user will go.

      Example..

      --------------------------------------
      Select your favourite Tv Show:

      ( ) 4400
      (o) Lost
      ( ) Prison Break

      Submit
      ---------------------------------------

      When the user presses submit, he will be sent to LOST state.
      I mean, currentState='lost'
      Or send him to state "prison" if he choose Prison Break.
      Like currentState='userselection' or something....

      Please someone help doing this!! Please!!

      Thanks!
        • 1. Re: Change a STATE depending in a radio button
          peterent Level 2
          <mx:RadioButton label="4400" click="newState='FortyFourHundredState' "/>
          etc.
          <mx:Button label="Submit" click="currentState=newState" />
          ...
          private var newState:String = "";
          • 2. Re: Change a STATE depending in a radio button
            Saintcorp Level 1
            Thanks. I got this solution from another forum:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
            <mx:states>
            <mx:State name="state1">
            <mx:AddChild position="lastChild">
            <mx:Label x="10" y="10" text="4400"/>
            </mx:AddChild>
            </mx:State>
            <mx:State name="state2">
            <mx:AddChild position="lastChild">
            <mx:Label x="10" y="10" text="Lost"/>
            </mx:AddChild>
            </mx:State>
            <mx:State name="state3">
            <mx:AddChild position="lastChild">
            <mx:Label x="10" y="10" text="Prison Break"/>
            </mx:AddChild>
            </mx:State>
            </mx:states>
            <mx:RadioButtonGroup id="groupSeries"/>
            <mx:RadioButton x="10" y="178" label="4400" id="option1"
            groupName="groupSeries" value="state1"/>
            <mx:RadioButton x="10" y="204" label="Lost" id="option2"
            groupName="groupSeries" value="state2"/>
            <mx:RadioButton x="10" y="230" label="Prison Break" id="option3"
            groupName="groupSeries" value="state3"/>
            <mx:Button x="10" y="256" label="Enviar" click="currentState=String(
            groupSeries.selectedValue)"/>
            </mx:Application>


            Thanks!