TweenMax .kill();

Recommended Posts

Hello everyone, I started to study TweenMax in AS3 environment.
I have 2 buttons, each button launches its animation.
When I press 1 button then animation 1 starts and it will work all the time even if I press 2 button.
Question: How can I stop animation when I call another animation?
Sorry for the English, I know him very badly.

[Embed(source = "image/anim1.png")] var Anim1:Class;
[Embed(source = "image/anim2.png")] var Anim2:Class;
var anim1 = new Anim1();
anim1.x = 1070;
anim1.y = 284;
var anim2 = new Anim2();
anim2.x = 1070;
anim2.y = 284;


private function button1(event:MouseEvent):void { 
			removeEventListener(Event.ENTER_FRAME,  button1), 6, {y:-10,x:-320, repeat:-1});
private function botton2(event:MouseEvent):void
			removeEventListener(Event.ENTER_FRAME,  button2), 6, {y:-10,x:-320, repeat:-1});



Share this post

Link to post
Share on other sites



Unfortunately we don't offer much support of the AS3 tools these days but it sounds like you should be creating references to your tweens so you can play() and pause() them, something like:


var ani1 =, 6, {y:-10,x:-320, repeat:-1, paused:true});

var ani2 =, 6, {y:-10,x:-320, repeat:-1, paused:true});

private function button1(event:MouseEvent):void { 
			removeEventListener(Event.ENTER_FRAME,  button1);
private function botton2(event:MouseEvent):void
			removeEventListener(Event.ENTER_FRAME,  button2);

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.