Solved

Flash form radio buttons - Set variable on selection

Posted on 2007-12-04
3
1,718 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
Comment Utility
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
Comment Utility
Worked like a charm. Thanks!
0
 
LVL 1

Expert Comment

by:FathomX
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

771 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

11 Experts available now in Live!

Get 1:1 Help Now