Elathic

by darman
♥0 | Line 22 | Modified 2009-07-22 14:34:46 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class ElathicTest extends Sprite {
        
        private var _circle:Sprite;
        private var vx:Number = 0;
        
        public function ElathicTest() {
            
            this._circle = new Sprite();
            this._circle.graphics.beginFill( 0xFF0000 );
            this._circle.graphics.drawCircle( -25, -25, 50 );
            this._circle.graphics.endFill();
            this.addChild( this._circle );
            
            //this._circle.x = stage.stageWidth /2;
            this._circle.y = stage.stageHeight /2;
            
            this.addEventListener(Event.ENTER_FRAME, this._loop );
        }
        
        private function _loop(e:Event):void{

            if ( this._circle.x == 350 ) { this._circle.x = 50; }
            vx = vx * 0.8 + (350 - this._circle.x) / 5;
            this._circle.x += vx;
            
        }
    }
}