Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var myTween:Tween = new Tween(this, "scaleX", Back.easeIn, 1.2, 0, 10);
- var myTween2:Tween = new Tween(this, "scaleY", Back.easeIn, 1.2, 0, 10);
- var myTween3:Tween = new Tween(this, "alpha", None.easeIn, 1, 0, 10);
- import fl.transitions.Tween;
- import fl.transitions.TweenEvent;
- import fl.motion.easing.Back;
- import fl.transitions.easing.None;
- // Populate an array with the tweens
- var tweens:Array = [];
- tweens.push(new Tween(this, "scaleX", Back.easeIn, 1.2, 0, 10));
- tweens.push(new Tween(this, "scaleY", Back.easeIn, 1.2, 0, 10));
- tweens.push(new Tween(this, "alpha", None.easeIn, 1, 0, 10));
- // Finished tweens count
- var finishedCount:int = 0;
- // Loop through all the tweens and add a handler for the motion finished event
- for (var i:int = 0; i < tweens.length; i ++)
- {
- // Each of the tweens motion finished event can be assigned to the same handler
- Tween(tweens[i]).addEventListener(TweenEvent.MOTION_FINISH, motionFinishedHandler);
- }
- function motionFinishedHandler(e:TweenEvent):void
- {
- // Good practice to remove the event listener when it is no longer needed
- e.target.removeEventListener(TweenEvent.MOTION_FINISH, motionFinishedHandler);
- // Increment the count and test whether it equals the number of tweens
- if (++ finishedCount == tweens.length)
- trace("Finished");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement