flash on 2012-3-16

by MMMMMonchi
♥0 | Line 24 | Modified 2012-03-16 10:22:19 | 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/wQdt
 */

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