flash on 2009-6-20
♥0 |
Line 52 |
Modified 2009-06-20 02:32:14 |
MIT License
archived:2017-03-20 02:59:13
ActionScript3 source code
/**
* Copyright takawo ( http://wonderfl.net/user/takawo )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/c4za
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
public class FlashTest extends Sprite {
private var tf:TextField;
public function FlashTest() {
// write as3 code here..
tf = new TextField();
addChild(tf);
tf.text = "hello";
var hello:Hello = new Hello(tf);
var button:Button = new Button();
addChild(button);
}
}
}
import flash.text.TextField;
import flash.display.Sprite;
class Hello extends Sprite
{
public function Hello(tf:TextField):void
{
tf.text = "hello world"
}
}
import flash.text.TextField;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
class Button extends Sprite
{
private var sp:Sprite;
public function Button():void
{
init();
}
private function init():void
{
sp = new Sprite();
sp.graphics.beginFill(0x44cc22);
sp.graphics.drawCircle(Math.random()*400,Math.random()*400,10);
sp.graphics.endFill();
sp.buttonMode = true;
addChild(sp);
sp.addEventListener(MouseEvent.CLICK,onClick);
}
private function onClick(event:MouseEvent):void
{
sp.removeEventListener(MouseEvent.CLICK,onClick);
removeChild(sp);
init();
}
}