flash on 2009-9-19
♥0 |
Line 29 |
Modified 2009-09-19 18:29:55 |
MIT License
archived:2017-03-30 09:38:46
ActionScript3 source code
/**
* Copyright hacker_9p8x8mco ( http://wonderfl.net/user/hacker_9p8x8mco )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7gWj
*/
package{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.utils.Timer;
public class Anime1 extends Sprite{
public function Anime1():void{
stage.addEventListener("click",clickHandler);
}
public function clickHandler(event:MouseEvent):void{
var s:Sprite = new Sprite();
s.graphics.beginFill(Math.random() * 0x100000);
s.graphics.drawCircle(0,0,10);
s.graphics.endFill();
addChild(s);
s.x = event.stageX;
s.y = event.stageY;
var timer:Timer = new Timer(50,20);
timer.start();
timer.addEventListener("timer",function(event:Event):void{
var ratio:Number = timer.currentCount / timer.repeatCount;
s.alpha = 1 - ratio;
});
timer.addEventListener("timerComplete",function(event:Event):void{
removeChild(s);
});
}
}
}