PDA

View Full Version : Play the onRelease but ignore the onRollout


yolise
04-03-2006, 10:41 AM
I'm sure this is an easy one...

I've got a simple set of animated buttons and want to play a particular bit of animation when the user clicks the button, but it's currently being interrupted by the onRollOut part unless you're very careful not to move the mouse.

How do I prevent the onRollOut being played when the user clicks the button?

Thanks in advance.

yolise
04-04-2006, 09:17 PM
Not so easy, perhaps?

sophistikat
04-04-2006, 09:25 PM
var isplaying = false;

my_btn.onRelease = function () {
isplaying = true;
something.gotoAndPlay("frameLabel");
}

my_btn.onRollOut = function () {
if (isplaying == false) {
something.gotoAndStop(1);
}
}setting a variable allows you to know that when the user rollout, if the variable is set to false, nothing is being animted, do something but if the variable is set to true, do nothing.

EDIT
at some point, probably at the end of the animations, you'll need to set the variable back to false
_parent.isplaying = false or _root.isplaying = false

yolise
04-04-2006, 09:30 PM
Ah ha! isplaying! Perfect. Thank you very much!