Moving an Object : Animation : Animation Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Animation » Animation »

 

Moving an Object


 

package {
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class Main extends Sprite {
        private var _sprite:Sprite = new Sprite(  );
        private var _vx:Number = 3;
        
        public function Main(  ) {
            _sprite.graphics.beginFill(0x0000ff100);
            _sprite.graphics.drawCircle(0025);
            _sprite.graphics.endFill(  );
            _sprite.x = 50;
            _sprite.y = 10;
            addChild(_sprite);
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        
        public function onEnterFrame(event:Event):void {
            _sprite.x += _vx;
        }
    }    
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Animation
» Animation