Laniakea
Laniakea

Reputation: 884

Stop flash slides on mouse click

EDIT:

I'm creating a flash banner where I have several objects that come and go. In the end of my banner a contact form appears. I need the animation to stop when the users clicks on any of the input fields. How do I achieve this in Actionscript 3?

Upvotes: 0

Views: 416

Answers (2)

moosefetcher
moosefetcher

Reputation: 1901

For each of your input fields add the following:

_inputField.addEventListener(MouseEvent.CLICK clickHandler);

Then add the following function:

public function clickHandler(e:MouseEvent):void {
stop();
}

The 'stop' assumes you're using the timeline as your animation. If the animation is contained in a MovieClip do something like the following:

_containingMovieClip.stop();

Upvotes: 1

DennisBo
DennisBo

Reputation: 48

You can make a mousover listener pointed to the banner

banner.addEventListener(MouseEvent.MOUSE_OVER,mouseOverNow)

banner.addEventListener(MouseEvent.MOUSE_OUT,mouseNotOverNow)

function mouseOverNow(e){
    stopSlide = true;
}
function mouseNotOverNow(e){
    stopSlide = false;
}

and you will have to make a check in your animation whether stopSlide is true or false before continuing to a new slide.

something like

if(!stopSlide){
    banner.play();
}

Upvotes: 1

Related Questions