flash on 2010-11-18

by fra978
♥0 | Line 27 | Modified 2010-11-18 00:35:03 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var ball:Ball = new Ball (200);
            ball.x = stage.stageWidth * .5;
            ball.y = stage.stageHeight * .5;
            addChild (ball);
        }
    }
}


/**
 * Ball
 * ボール生成クラス.
 */
class Ball extends flash.display.Sprite {
    public var radius:Number;
    private var color:uint;
    public var vx:Number = 0;
    public var vy:Number = 0;

    public function Ball(radius:Number=40, color:uint=0x990033) {
        this.radius = radius;
        this.color = color;
        init();
    }

    public function init():void {
        graphics.beginFill(color);
        graphics.drawCircle(0, 0, radius);
        graphics.endFill();
    }
}