here is the code
Code:package { import flash.events.MouseEvent; import flash.display.MovieClip; import flash.text.TextField; public class MouseExample extends MovieClip { public function MouseExample() { this.parent.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); this.parent.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } private function mouseDownHandler(event:MouseEvent):void { trace("Stage mousedown"); var newBut:MyButton = new MyButton (mouseX, mouseY); this.addChild (newBut); var myText:TextField = new TextField(); myText.text = "Press the button."; this.addChild(myText); } private function mouseUpHandler(event:String):void { trace("Stage mouseup"); } } }





Reply With Quote