In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

円を大小させる

Get Adobe Flash player
by takahiro_nakamori 18 Mar 2011
    Embed
/**
 * Copyright takahiro_nakamori ( http://wonderfl.net/user/takahiro_nakamori )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xBtx
 */

// forked from takahiro_nakamori's 円を上下に動かす
// forked from takahiro_nakamori's 円を描いてみる
package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class Move extends Sprite {
        private var ball:Ball;
        private var angle:Number = 0;
        private var scale:Number = 1;
        private var range:Number = .5;
        private var speed:Number = .05;
        
        public function Move(){
            init();
        }
        
        private function init():void{
           ball = new Ball(100,0x987987);
           addChild(ball);
           ball.x = stage.stageWidth / 2;
           ball.y = stage.stageHeight / 2;
           addEventListener(Event.ENTER_FRAME,onEnterFrame);
        }
        
        public function onEnterFrame(e:Event):void{
            ball.scaleX = scale + Math.sin(angle) * range;
            ball.scaleY = ball.scaleX;
            angle += speed;
        }
    }
}

import flash.display.Sprite;

class Ball extends Sprite {
    private var radius:Number;
    private var color:uint;
        
    public function Ball(radius:Number =40, color:uint=0xff0000) {
       this.radius = radius;
       this.color = color;
       init();
    }
    private function init():void{
        graphics.beginFill(color);
        graphics.drawCircle(0,0,radius);
        graphics.endFill();
    }
}