package { import flash.display.Sprite; import mx.controls.*; import flash.events.*; import flash.text.*; public class FlashTest extends Sprite { public function FlashTest() { // write as3 code here.. var btn:Button = new Button(); stage.addEventListener(MouseEvent.CLICK, showMes); } public function showMes(e:Event):void { var mytxt:TextField= new TextField(); mytxt.text = String(e.type); this.addChild(mytxt); } } }