Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

How to stop a tween without creating a tween object?

Recommended Posts


in my code i generate n number of items and assign tween to them. below is the sample code:

for(var i=0; i<myArr.length; i++){
var item:myObj = new myObj();
TweenLite.to(item, 30, {x:1200});


Now, on clicking on one item, i want to remove its tween. how can i achieve this?

Link to comment
Share on other sites

instead of "TweenLite.to" if I create object of the tween:

var myTween:TweenLite = new TweenLite.....


how will i get the tween of the clicked item?

Link to comment
Share on other sites

If you want to remove it's tween:

function killEm(e:MouseEvent):void




myObj.addEventListener(MouseEvent.CLICK, killEm);


If you want to pause its tween:

// Create tween using var

var myTween:TweenLite = new TweenLite.....

//Assign the tween as a property of the object:

myObject.tween = myTween;

// Setup eventListener and function

myObj.addEventListener(MouseEvent.CLICK, pauseTween);


function pauseTween(e:MouseEvent):void




  • Like 3
Link to comment
Share on other sites

ah, thanks A LOT pixeldroid :)

Link to comment
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.