button1.onPress=gotoAndStop(1);
{
}
3 Replies - 1393 Views - Last Post: 15 January 2012 - 12:18 PM
#1
question about using radio buttons in actionscript 3.0
Posted 09 January 2012 - 03:15 PM
Is it possible, (and if so, how), to move to a different frame when a radio button is selected? I have tried
Replies To: question about using radio buttons in actionscript 3.0
#2
Re: question about using radio buttons in actionscript 3.0
Posted 13 January 2012 - 04:28 PM
After much further searching, I found the code myself.
radio1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(2);
}
#3
Re: question about using radio buttons in actionscript 3.0
Posted 14 January 2012 - 09:27 AM
jk145, on 13 January 2012 - 04:28 PM, said:
After much further searching, I found the code myself.
radio1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(2);
}
This works for whenever someone clicks the radio button, but it will do the action whether you are selecting or deselecting it. I have tried to find how to do the action only when you are selecting it, but I haven't found anything that will work yet. What am I missing.
#4
Re: question about using radio buttons in actionscript 3.0
Posted 15 January 2012 - 12:18 PM
I am not sure your question makes a ton of sense with radio buttons. If you click on it and it is enabled it will always be selecting the radio, never unselecting it. A checkbox would make more sense here...
However, there is the selected attribute which is either set to true or false on the RadioButton and CheckBox components; you can use that to see if something was selected when clicked or not.
Example:
Hope that helps.
However, there is the selected attribute which is either set to true or false on the RadioButton and CheckBox components; you can use that to see if something was selected when clicked or not.
Example:
import flash.events.MouseEvent;
import flash.display.MovieClip;
r1.addEventListener(MouseEvent.CLICK, onclick);
function onclick(evt:MouseEvent):void{
var target:RadioButton = evt.target as RadioButton;
trace(target.selected);
}
Hope that helps.
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote




|