Solved

Flash form radio buttons - Set variable on selection

Posted on 2007-12-04
3
1,719 Views
Last Modified: 2010-04-21
Hello,

I'm trying to do something that seems somewhat simple on the surface but I've yet to come up with a solution:

I have 3 radio buttons within an embedded swf with the following parameters:

button1
data: blue
groupName: Colors

button2
data: red
groupName: Colors

button3
data: yellow
groupName: Colors

When button2 is selected, I need the global variable, _global.theColor, set to "red".

Any direction is greatly appreciated.

thanks
0
Comment
Question by:wattanabi2
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
FathomX earned 250 total points
ID: 20404480
i just recreated what i think you're trying to do.
first I made the buttons and named the three button1, button2, button3. Then on the FRAME i put this code.

_global.theColor = "black";
trace (_global.theColor);


Then I selected button1 and put this AS on it:

on(click){
      _global.theColor = "blue";
      trace (_global.theColor);
}



then on button2 this AS:

on(click){
      _global.theColor = "blue";
      trace (_global.theColor);
}


finally on button3 this AS:

on(click){
      _global.theColor = "blue";
      trace (_global.theColor);
}



Once you test the movie and click on one of the buttons you'll notice the output window will trace the _global.theColor var
0
 

Author Closing Comment

by:wattanabi2
ID: 31412606
Worked like a charm. Thanks!
0
 
LVL 1

Expert Comment

by:FathomX
ID: 20404541
i'm sorry, on button2 i put:
on(click){
      _global.theColor = "red";
      trace (_global.theColor);
}

on button3 i put:
on(click){
      _global.theColor = "yellow";
      trace (_global.theColor);
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now