flash on 2010-1-2

by hacker_yk666qry
♥0 | Line 28 | Modified 2010-01-02 11:17:57 | MIT License
play

ActionScript3 source code

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

package {
	import flash.events.MouseEvent;
	import flash.utils.clearInterval;
	import flash.utils.IDataInput;
	import flash.display.MovieClip;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            stage.addEventListener(MouseEvent.CLICK, onClick);
        }
        
        
        private function onClick(event:MouseEvent):void {
          // 半径をランダムでセット
           var nR:int = Math.ceil(Math.random() * 100) + 10; 
           // 色をランダムで選ぶ
            var color:int = Math.floor(Math.random() * 0xffffff);
           var color2:int = Math.floor(Math.random() * 0xffffff);
           // 円のクラスのインスタンスを作る
           var oneCircle:DrawCircle = new DrawCircle(event.stageX, event.stageY, nR, color, color2); 
           // 円のインスタンスを表示リストに追加する
            addChild(oneCircle); 
        }
    }
}




import flash.display.MovieClip;

class DrawCircle extends MovieClip {
	public function DrawCircle(centerX:int, centerY:int, r:int, color:int, color2:int) {
		graphics.beginFill(color2);
		graphics.lineStyle(2, color);
		graphics.drawCircle(centerX,centerY,r);
		graphics.endFill();
	}
}