forked from: flash on 2010-2-3
forked from flash on 2010-2-3 (diff: 37)
ActionScript3 source code
/**
* Copyright uepon24 ( http://wonderfl.net/user/uepon24 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3dVR
*/
package{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class MouseClick extends Sprite {
//初期化
public function MouseClick(){
stage.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
}
private function onClick(event:MouseEvent):void{
//半径をランダムでセット
var nR:int = Math.ceil(Math.random() * 20) + 10;
//色をランダムで選ぶ
var color:int = Math.floor(Math.random()* 0xffffff);
var circle:Sprite = new DrawCircle(event.stageX, event.stageY, nR, color);
addChild(circle);
}
}
}
import flash.display.MovieClip;
class DrawCircle extends MovieClip {
public function DrawCircle(centerX:int, centerY:int, r:int, color:int){
graphics.lineStyle(2, color);
graphics.drawCircle(centerX, centerY, r);
}
}
