topical media & game development

talk show tell print

animation-ch02-FirstAnimation.ax

animation-ch02-FirstAnimation.ax [swf] [flash] flex


  package {
   import flash.display.Sprite;
   import flash.events.Event;
   
   public class @ax-animation-ch02-FirstAnimation extends Sprite {
    private var ball:Sprite;
  
    public function @ax-animation-ch02-FirstAnimation() {
     init();
    }
  

init(s)


    private function init():void {
     ball = new Sprite();
     addChild(ball);
     ball.graphics.beginFill(0xff0000);
     ball.graphics.drawCircle(0, 0, 40);
     ball.x = 20;
     ball.y = stage.stageHeight / 2;
     ball.addEventListener(Event.ENTER_FRAME, onEnterFrame);          
    }
  

frame(s)


    private function onEnterFrame(event:Event):void {
     ball.x++;
    }
   }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.