flash on 2012-3-12

by MMMMMonchi
♥0 | Line 24 | Modified 2012-03-12 04:42:09 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.events.Event;
    [SWF(frameRata=40,width=465,height=465)]
   
    public class FlashTest extends Sprite {
       public var circle:Sprite;
        public function FlashTest() {
        circle=new Sprite();
        circle.graphics.beginFill(0xff00ff);
        circle.graphics.drawCircle(10,10,10);
        circle.graphics.endFill();
        
        addChild(circle);
        addEventListener(Event.ENTER_FRAME,move);
        
        
        
            
        }
     private function move(e:Event):void{
         var vx:int=5;
         var vy:int=5;
         circle.x+=vx;
         circle.y+=vy;
         
         if (circle.x<0||circle.x>=stage.width)vx=-vx;
         if (circle.y<0||circle.y>=stage.height)vy=-vy;
         
         
         
         }
      
    }
}