1 Reply Latest reply on Sep 29, 2006 12:32 PM by TimSymons

    Help With Radio Buttons -- URGENT!!

    leewilson86 Level 1
      Hi i am new to using UI compents in flash.

      Basically i havnt a clue where to start.

      Just some simple action script will help and be much appreciated if someone can give me it.

      Basically i have a question to ask which requires radio buttons to answer the question.

      I have a question and the answers are A, B, C, D.

      I want:

      A to equal 1
      B to equal 2
      C to equal 3
      D to equal 4
      E to equal 5

      Would someone be able to tell me how to set up the radio button so that the value of the radio button is stored into an array called SCORE.

      i dont need a tutor for arrays, i can do them, i just need help with the radio buttons so a reference to an array would be enough, eg how to store the answer from the radio button in an array.

      Thank you
        • 1. Re: Help With Radio Buttons -- URGENT!!
          TimSymons Level 1
          Place the radio buttons on the stage and set their parameters to what you need. Make sure that for each group of radio buttons you give them the same group name. Then you could use something like this:

          var listenerObject:Object = new Object();
          var answerArr:Array = new Array();
          listenerObject.click = function(eventObj:Object) {
          answerArr.push(eventObj.target.selectedData);
          trace(answerArr);
          };
          radioGroup.addEventListener("click", listenerObject);

          radioGroup refers to the group name for the buttons.
          eventObj.target will refer to the actual radio button clicked.

          Tim