flash on 2009-10-2

by telcanty
♥0 | Line 36 | Modified 2009-10-02 08:47:31 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var new_ball:Ball = new Ball();
                new_ball.x = stage.stageWidth / 2;
                new_ball.y = stage.stageHeight / 2;
            this.addChild(new_ball);
            
        }
    }
}

import flash.display.Sprite;

class Ball extends Sprite{
    
    private var _defaultColor:uint = 0xFF0000;
    private var _color:uint;
    
    public function Ball()
    {
        _color = _defaultColor;
        _draw();
    }
    
    private function _draw(c):void
    {
           graphics.beginFill(_color);
           graphics.drawCircle(0,0,20);
           graphics.endFill();  
    }
    
    public function set color(c:uint):void
    {
        _color = c;
         _draw();
    }
    
    public function get color():uint
    {
        return _color;
    }
 
}