flash on 2010-2-28

by ushisantoasobu
♥0 | Line 40 | Modified 2010-02-28 22:40:22 | MIT License
play

ActionScript3 source code

/**
 * Copyright ushisantoasobu ( http://wonderfl.net/user/ushisantoasobu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/dtXQ
 */

package{
	import caurina.transitions.Tweener;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
		
	[swf(width=465, height=465, frameRate=30, backgroundColor=0xffffff)]

	public class Sample extends Sprite{
		public function Sample(){
			var ball:Sprite = new Sprite();
			ball.x = 100;
			ball.y = 100;
			
			ball.graphics.beginFill(0x000000);
			ball.graphics.drawCircle(0, 0, 40);
			ball.graphics.endFill();
			addChild(ball);
			ball.addEventListener(MouseEvent.CLICK, ballClickHandler);
			ball.buttonMode = true;
			Tweener.addTween(ball,{
				x: 300,
				scaleX: 0,
				scaleY: 0,
				time: 4,
				transition: "easeInOutSine",
				onComplete: tweenCompleteHandler,
				onCompleteParams: [ball]
			});
		}
		private function tweenCompleteHandler(ball:Sprite):void{
			Tweener.addTween(ball, {
				y: 300,
				scaleX: 2,
				scaleY: 2,
				time: 4,
				transition: "easeInExpo"
			});
		}
		private function ballClickHandler(e:MouseEvent):void{
			Tweener.removeTweens(e.target);
		}
	}
}