Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. var myTween:Tween = new Tween(this, "scaleX", Back.easeIn, 1.2, 0, 10);
  2. var myTween2:Tween = new Tween(this, "scaleY", Back.easeIn, 1.2, 0, 10);
  3. var myTween3:Tween = new Tween(this, "alpha", None.easeIn, 1, 0, 10);
  4.  
  5. import fl.transitions.Tween;
  6. import fl.transitions.TweenEvent;
  7. import fl.motion.easing.Back;
  8. import fl.transitions.easing.None;
  9.  
  10. // Populate an array with the tweens
  11. var tweens:Array = [];
  12. tweens.push(new Tween(this, "scaleX", Back.easeIn, 1.2, 0, 10));
  13. tweens.push(new Tween(this, "scaleY", Back.easeIn, 1.2, 0, 10));
  14. tweens.push(new Tween(this, "alpha", None.easeIn, 1, 0, 10));
  15.  
  16. // Finished tweens count
  17. var finishedCount:int = 0;
  18.  
  19. // Loop through all the tweens and add a handler for the motion finished event
  20. for (var i:int = 0; i < tweens.length; i ++)
  21. {
  22. // Each of the tweens motion finished event can be assigned to the same handler
  23. Tween(tweens[i]).addEventListener(TweenEvent.MOTION_FINISH, motionFinishedHandler);
  24. }
  25.  
  26. function motionFinishedHandler(e:TweenEvent):void
  27. {
  28. // Good practice to remove the event listener when it is no longer needed
  29. e.target.removeEventListener(TweenEvent.MOTION_FINISH, motionFinishedHandler);
  30.  
  31. // Increment the count and test whether it equals the number of tweens
  32. if (++ finishedCount == tweens.length)
  33. trace("Finished");
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement