Solved

Flash form radio buttons - Set variable on selection

Posted on 2007-12-04
3
1,720 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

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…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

770 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