flash on 2010-5-3
♥0 |
Line 36 |
Modified 2010-05-03 15:49:48 |
MIT License
archived:2017-03-20 02:56:08
ActionScript3 source code
/**
* Copyright simultechnology ( http://wonderfl.net/user/simultechnology )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zSD0
*/
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
public class TimeKeeper extends Sprite
{
public function TimeKeeper()
{
var timeball:Object = (function():Object{
var ball:Sprite;
var w:Number;
var h:Number
var tf:TextField;
var count:Number = 0;
return function(posx:Number, posy:Number):Sprite {
ball = new Sprite();
ball.graphics.beginFill(Math.random() * 100 * 0xFFFFFF, Math.random());
w = Math.random() * 200;
h = Math.random() * 100;
tf = new TextField();
count += 1;
tf.text = count + ". " + new Date().toTimeString();
tf.x = posx;
tf.y = posy;
ball.addChild(tf);
ball.graphics.drawRoundRect(posx, posy, w, h, 1);
return ball;
}
})();
this.stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
addChild(timeball(mouseX, mouseY));
});
}
}
}