flash on 2011-12-12
/**
* Copyright tjoen ( http://wonderfl.net/user/tjoen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/yQxh
*/
package {
import flash.display.MovieClip;
import flash.events.*;
import flash.utils.*;
public class Circle extends MovieClip {
public var count:int = 0;
public function Circle() {
var blah = setInterval(init, 10);
}
private function init() {
var thiscircle:MovieClip = new MovieClip;
thiscircle.graphics.beginFill(0x0000FF);
thiscircle.graphics.drawCircle(0,0,1);
thiscircle.graphics.endFill();
thiscircle.x = Math.floor(Math.random()*550);
thiscircle.y = Math.floor(Math.random()*400);
thiscircle.alpha = Math.random();
thiscircle.scaleX = Math.floor(Math.random()*10);
thiscircle.scaleY = thiscircle.scaleX;
thiscircle.addEventListener(Event.ENTER_FRAME,onEnterFrameMove);
addChild(thiscircle);
count++;
if (count > 60) {
removeChildAt(0);
}
}
private function onEnterFrameMove(event:Event) {
var me = event.target;
var yEnd = mouseY;
var xEnd = mouseX;
me.x += (xEnd-me.x)/4;
me.y += (yEnd-me.y)/4;
}
}
}