forked from: forked from: forked from: forked from: flash on 2010-4-16
/**
* Copyright hacker_3q88gl5n ( http://wonderfl.net/user/hacker_3q88gl5n )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/seSf
*/
// forked from hacker_3q88gl5n's forked from: forked from: forked from: flash on 2010-4-16
// forked from hacker_3q88gl5n's forked from: forked from: flash on 2010-4-16
// forked from hacker_3q88gl5n's forked from: flash on 2010-4-16
// forked from hacker_3q88gl5n's flash on 2010-4-16
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class Index extends Sprite {
private var circleContainer:Array = [];
private var circle:DrawCircle;
public function Index() {
stage.addEventListener(MouseEvent.MOUSE_UP, addCircle);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
};
private function addCircle(e:MouseEvent):void {
circle = new DrawCircle();
circle.x = mouseX;
circle.y = mouseY;
addChild(circle);
circleContainer.push(circle);
}
private function removeCircle(i:int):void {
var circle:DrawCircle = circleContainer[i];
removeChild(circle);
circleContainer.splice(i,1);
}
private function enterFrameHandler(e:Event):void {
var i:int;
var circle:DrawCircle;
for(i=0; i<circleContainer.length; i++){
circle = circleContainer[i];
circle.step();
//if文はこういう書き方もできる
if(circle.count > circle.countMax-1) removeCircle(i);
}
};
}
}
import flash.display.Sprite;
class DrawCircle extends Sprite {
public var count:int = 0;//private var count:int = 0;から修正
public var countMax:int = 20;//
public function DrawCircle() {
}
public function step():void {
count++;
//修正
var r:int = count*5;
graphics.lineStyle(1, 0x00FF99, ((countMax-count)/count));
graphics.drawCircle(0, 0, r);
if(count > countMax) {
graphics.clear();
}
}
}