views:

33

answers:

1

I need help with AS3 for an animated button. The button (movie clip) I've created starts playing on a mouse-over but stops immediately when a mouse-out event occurs. But I want the button to finish the loop cycle before stopping the animation and play the animation on the next mouse-over from frame 1.

This is the code I have so far:

stop();
bt.addEventListener(MouseEvent.MOUSE_OVER,onMouseOver);
function onMouseOver(event:MouseEvent):void {
    gotoAndPlay(1);
}

Thanks in advance, Jenya

+1  A: 

It seems you're not playing the button but the button's container actually.

Maybe try :

bt.gotoAndPlay(1)

or

(event.target as MovieClip).gotoAndPlay(1).

All you should have to do is to add a to stop() on the first frame of the button so it doesn't loop forever.

Theo.T
Thank for your reply. Unfortunately, the button is behaving the same way.
Jenya