Reputation: 884
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
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
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