forked from: 円運動

by hacker_szoe51ih forked from 円運動 (diff: 10)
♥0 | Line 39 | Modified 2010-05-11 23:43:20 | MIT License
play

ActionScript3 source code

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

// forked from hacker_szoe51ih's 円運動
// forked from hacker_szoe51ih's forked from: forked from: flash on 2010-5-2
// forked from hacker_szoe51ih's forked from: flash on 2010-5-2
// forked from hacker_szoe51ih's flash on 2010-5-2
package {
    import flash.display.*;
    import flash.events.*;
    
    [SWF(backgroundColor="#dddddd", width="500", height="500", frameRate="30")]
    
    public class FlashTest extends Sprite {
    	public var rot:Number;
    	public var hankei:Number;
    	public var centerX:Number;
    	public var centerY:Number;
    	public var ball:Sprite;
   
        public function FlashTest() {
        	stage.quality=StageQuality.HIGH;
        	stage.scaleMode=StageScaleMode.NO_SCALE;
        	stage.align=StageAlign.TOP_LEFT;
         
            hankei=0;
            rot=0;
            centerX=this.stage.stageWidth/2-100;
            centerY=this.stage.stageHeight/2-100;
            
            //ボールを作る
            ball=new Sprite();
            ball.graphics.beginFill(0x000000);
            ball.graphics.drawCircle(100,100,10);
            ball.graphics.endFill();
            addChild(ball);
            ball.x=this.stage.stageWidth/2;
            ball.y=this.stage.stageHeight/2;
          
           this.addEventListener(Event.ENTER_FRAME,loop);
           
        }
        
        public function loop(e:Event):void{
        if(hankei<200){
       			hankei+=0.5;       		
       	}else{
       		hankei=0;
       	}
        rot += 15;
        	ball.x=centerX+hankei*Math.cos(rot*Math.PI/180);
        	ball.y=centerY+hankei*Math.sin(rot*Math.PI/180);
       	
       	
       	
        }
        
        
    }
}