Copy link to clipboard
Copied
What the best way to make this working like a radio button?
Copy link to clipboard
Copied
yes.
create your graphics and use code to control their behavior.
Copy link to clipboard
Copied
I'm using this code but it doesn't work when question (in this case movie clip) is more than one. How can we fix this and not have any error?
import flash.events.MouseEvent;
stop();
var Pilihan1:MovieClip = MovieClip(this.getChildByName("Pilihan1"));
Pilihan1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
Pilihan1.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
Pilihan1.addEventListener(MouseEvent.CLICK, mouseClickHandler);
function mouseOverHandler(e:MouseEvent){
if(e.target.currentFrame<3){
e.target.gotoAndStop(2);
}
}
function mouseOutHandler(e:MouseEvent){
if(e.target.currentFrame<3){
e.target.gotoAndStop(1);
}
}
function mouseClickHandler(e:MouseEvent){
e.target.gotoAndStop(3);
Pilihan1.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
Pilihan1.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
Pilihan1.removeEventListener(MouseEvent.CLICK, mouseClickHandler);
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi.
Adding to k's answer, is it AS3 or HTML5 Canvas?
Regards,
JC
Copy link to clipboard
Copied
It's Actionscript 3
Copy link to clipboard
Copied
what problem are you having?
Copy link to clipboard
Copied
Thanks.
Are you familiar with using classes and other Object Oriented Programming concepts?
It's not mandatory to use OOP for this, but I think it's a very good candidate for radio buttons.
Copy link to clipboard
Copied
No, I'm not ;')