hey guys.
Please help me; I cannot figure out how to do this in Actionscript 3.0:
Using movie clip buttons, how do you get the button to stay in the “mouse over” state after it has been clicked? I do not want the button to do anything at all after it is clicked.
I found this online and it works perfectly for actionscript 2.0 but i need it in 3.0. anyone know how to do this in 3.0?
MovieClip.prototype.checkMe = function() {
if (this._currentframe == 2) {
this.btn.enabled = true;
this.gotoAndStop(1);
}
};
btn_mc1.btn.onRelease = function() {
btn_mc1.btn.enabled = false;
btn_mc2.checkMe();
btn_mc3.checkMe();
};
btn_mc2.btn.onRelease = function() {
btn_mc2.btn.enabled = false;
btn_mc1.checkMe();
btn_mc3.checkMe();
};
btn_mc3.btn.onRelease = function() {
btn_mc3.btn.enabled = false;
btn_mc2.checkMe();
btn_mc1.checkMe();
};
Please help and THANK YOU
i know the code is not in AS3. I need to know how to do this in AS3. this code does what i want in AS2 but i want it in AS3 and i cannot figure out how to do it.
thanks for the comment.
there are a few things to know.
Once you have a button or movieclip acting as a button, you need to make it “listen” for a mouse click on it (or any mouse event, such as roll over, roll out, etc).
so, for example:
ActionScript Code:
[LEFT]btn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], onClick[COLOR=#000000])[/COLOR];
[COLOR=#000000]function[/COLOR] onClickCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]//do something - i’m not sure if “enabled” and “disabled” is part of as3 any longer[/COLOR]
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR]; [COLOR=#808080]//traces the btn clicked - you can access it’s properties/mthods via e.target[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]