moving circle

by wexler
♥0 | Line 27 | Modified 2010-11-14 09:04:52 | MIT License
play

ActionScript3 source code

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

// forked from okd's test on 2010-11-13
package {
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.events.Event;

    [SWF(backgroundColor="#F808080", width=600, height=600, frameRate=60)]
    public class AnimTest extends Sprite {
        private var shape:Shape;
        
        public function AnimTest() {
            
            var x:int = 0;
            var y:int = 0;
            var w:int = 45;
            var h:int = 40;
            
            shape = new Shape();
            shape.graphics.beginFill(0xff3300);
            shape.graphics.drawCircle(x, y, 20);
            shape.graphics.drawCircle(x + 100, y, 10);
            shape.graphics.endFill();
                                  
            addChild(shape);
            
            addEventListener(Event.ENTER_FRAME, draw);
        }
           
        public function draw(event:Event):void {
            shape.rotation = (shape.rotation + 3) % 360;
            shape.x += 2;
            shape.y += 2;
        }
    }
}