flash on 2009-6-18
/**
* Copyright takawo ( http://wonderfl.net/user/takawo )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8iK9
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
import flash.events.MouseEvent;
public class FlashTest extends Sprite {
private var tf:TextField;
private var sp:Sprite;
private var spBase:Sprite
[SWF(backgroundColor="#333333", frameRate=10)]
public function FlashTest()
{
spBase = new Sprite();
addChild(spBase);
for(var i:uint = 0; i < 1000; i++)
{
sp = new Sprite();
sp.graphics.beginFill(Math.random()*0xFFCCFF);
sp.graphics.drawCircle(Math.random()*450,
Math.random()*450,10);
addChild(sp);
sp.name = "circle" + i;
sp.alpha = 0.2;
sp.addEventListener(MouseEvent.CLICK,onClick);
sp.buttonMode = true;
sp.useHandCursor = true;
}
tf = new TextField();
addChild(tf);
tf.text ="hello world!";
}
private function onClick(event:MouseEvent):void
{
tf.text = event.target.name
}
}
}