package { import flash.display.*; import flash.events.*; import flash.text.*; public class Main extends Sprite { public function Main ( ) { var circle:Sprite = new Sprite( ); circle.graphics.beginFill(0x999999, 1); circle.graphics.lineStyle(1); circle.graphics.drawEllipse(0, 0, 100, 100); var textfield:TextField = new TextField( ); textfield.text = "Click here"; textfield.autoSize = TextFieldAutoSize.LEFT; textfield.x = 30; textfield.y = 30; textfield.border = true; textfield.background = true; textfield.mouseEnabled = false; addChild(circle); addChild(textfield); circle.addEventListener(MouseEvent.CLICK, clickListener); } private function clickListener (e:MouseEvent):void { trace("User clicked: " + e.target); DisplayObject(e.target).x += 10; } }}
Name (required)
email (will not be published) (required)
Website