1 Reply Latest reply on Feb 26, 2008 4:18 PM by robdillon

    simple if then scenario with radio buttons

    marknestor Level 1
      Hi there. I'm a newbie at this kind of thing, so I hope someone can help me out here. I have a scenario whereby there is a question with two radio buttons (one says yes, the other no). I also have a "next" button, and I want to tell that next button to go to a certain frame based on which radio button is pushed. I have it setup so that they are in the same group so they toggle, but I can't seem to get it to do what I want. I have this code on the next button, but no matter what, it always goes to frame 100, never 50.

      Again, don't really know what I'm doing here, so this code is probably pretty ugly.

      on (release) {
      trace(cabinet_yes.selected);
      }
      on (release) {
      if (cabinet_yes.selected = true) {
      }
      gotoAndStop(50);
      }
      on (release) {
      if (cabinet_yes.selected = false) {
      }
      gotoAndStop(100);
      }


      thanks

        • 1. Re: simple if then scenario with radio buttons
          robdillon Most Valuable Participant
          If you are just getting started with Actionscript then please get started by using Actionscript correctly. You should never attach code directly to any object in Flash, ever, for any reason. You should be writing your actions to a frame script space. When you move to Flash CS3, you will have to do that if you want to use Actionscript 3.

          In any case, when you work with the radio button component, you can set them to work as a group. By default they will group themselves. When you place each of the radio button component instances on the stage, select each one and then click on the Parameters tab of the Property Inspector window. In there, you can set the label and the data value for each button in the group. You'll see that the group name is already set to "radioGroup". You will be addressing the buttons by their group name, so you don't need to name each component instance individually.

          Now, in the first frame of a new layer. You will write your actionscript here. Select the first keyframe and open the actions window. Add this code: