6 Replies Latest reply on May 16, 2006 12:50 PM by MikeMedia2

    Just a little syntax help ...please!

    MikeMedia2
      What is the exact syntax to identify define one of multiple radioButtonGroups?
      What is the exact syntax to identify a specific radio button in that group?

      I’ve got four (4) radio button components
      I have set the following parameters in the Properties Panel
      They are labeled respectively (a., b., c., d.)
      The data for a., b., and d. is 0. c. is 10
      The groupName for all 4 is q1


      Here is one of the variations that I have tried: [
      b]trace(radioButtonGroup.q1.selectedData)[/b}

      I want any selection in group q1 to return the value (data) of the selected radio button component.

        • 1. Re: Just a little syntax help ...please!
          kglad Adobe Community Professional & MVP
          assign each radiobutton a groupName. assign all radiobuttons that are in the same group the same groupName and those in different groups, a different groupName.

          use the data property of radiobuttons to retrieve the data associated with any particular radiobutton. use the selection property of each group to retrieve the selected button in that radiogroup.
          • 2. Re: Just a little syntax help ...please!
            MikeMedia2 Level 1
            I’ve got four (4) radio button components In the Properties Panel

            They are labeled respectively (a., b., c., d.)
            The data for a., b., and d. is 0. c. is 10
            The groupName for all 4 is q1

            I can select (click) any one radio button component in group “q1” and get a return of the b]data of that selected radio button component (but I'm not sure it's a "numeric" value).

            However,
            trace(radioButtonGroup.q1.selectedData)
            returns “undefined”.
            • 3. Re: Just a little syntax help ...please!
              kglad Adobe Community Professional & MVP
              q1.selection.data will return the data associated with the selected radiobutton in group q1.
              • 4. Re: Just a little syntax help ...please!
                MikeMedia2 Level 1
                I continue to wrestle with the constructs of AS2 syntax, i.e. what order to identify and address radiobutton component instances. And oh yes, I have indeed scoured help and livedocs, and tried kglad's answer in this thread.

                I have four (4) radio buttons with the individual instances and parameters established.
                Each group of 4 is assigned respectively to 3 named radioGroups (see the beginnig of this thread).
                Finally, there is a standard on (release) { button script that asks for a return from each radioGroup of the data associated with any selected radioButton in that group .
                o o o
                o o o
                o o o
                o o o
                [total score result btn] // this is the AS coded object

                Variations of what I have coded continue to return "undefined".
                Here is one example of what I have written: (q.1 is the first groupName)

                on (release) {
                trace(q1.selection.data)
                }

                Thanks
                • 5. Re: Just a little syntax help ...please!
                  kglad Adobe Community Professional & MVP
                  if trace(q1.selection.data) returns undefined, you have no radiogroup named q1 in the scope of that button. if that button is a movieclip button, your radiobuttons will need to be on the movieclip's timeline. if your button is a true button, then your radiobuttons need to be on the same timeline as your button.

                  and finally, when you defined your radiogroup, did you put q1 in quotes? ie,

                  • 6. Just a little syntax help ...please!
                    MikeMedia2 Level 1
                    kglad,
                    Thank you very much for all the attention that you have given me. Things still aren't working though.
                    I really have tried to do exactly all that you have instructed.
                    I wrote:
                    q1a.groupName="q1";
                    q1c.groupName="q1";
                    q1d.groupName="q1";
                    q1e.groupName="q1";
                    even though I think I established all this on the "Parameters Panel".

                    And I wrote (q1.selection.data) . Still it returned undefined after I selected a radio button of that group, and then clicked the "Total Score" button. (which by the way, is where all the AS is embeded.)

                    No matter what variation of syntax that I use the radioGroup remains undefined. I even tried this:
                    var apple=groupName.q1.getData();
                    I thought maybe apple=groupName.q1.radioInsanceName.getData(); might work, but nope.

                    What I am asking for is: var answer1 = the radioGroup.radioInstance.selectedData
                    I want to click on any button within the radioGroup q1 and get the radioGroup to return the data (value?) of the selected radioButton.
                    In order to do this, I need to understand how to call, by name, each radioButton and the radioGroup housing them.

                    Because I am obviously easily confused, would you answer using the names I've already established.

                    Finally, please tell me the name of a solid AS2 primer!

                    Thank you again.