flash on 2011-3-23

by yama3
♥0 | Line 46 | Modified 2011-03-23 01:15:30 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import caurina.transitions.Tweener;
    
    [SWF(width=465, height=465, frameRate=30, backgroundColor=0xffffff)]
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            //オブジェクトを作成
            var ball:Sprite = new Sprite();
            //座標を指定
            ball.x = 100;
            ball.y = 100;
            
            //丸を指定
            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,
                time: 2,
                scaleX:0,
                scaleY:0,
                transition:"easeInOutSine",
                onComplete: tweenCompleteHandler,
                onCompleteParams: [ball]
                });            
        }
        private function tweenCompleteHandler(ball:Sprite):void
{
    //2回目
    Tweener.addTween(ball,
    {
        y:300,
        scaleX:2,
        scaleY:2,
        time:1,
        transition:"easeInExpo"
    }
    );
}

    private function ballClickHandler(evt:MouseEvent):void
    {
        Tweener.removeTweens(evt.target);
    }

    }
}