/* Open a new FLash file (ActionScript 3.0). Select TimeLine --> Top Layer --> Frame 1 Select Window --> Actions (F9) Copy and paste this snippet Observe the Stage */ // We create a rectangle using the MovieClip class. var instanceName:MovieClip = new MovieClip(); instanceName.graphics.lineStyle(1, 0x00FF00); instanceName.graphics.beginFill(0xFFDEAD); instanceName.graphics.drawRect(300,100,25,25); instanceName.graphics.endFill(); addChild(instanceName); instanceName.addEventListener(MouseEvent.CLICK, onClick); function onClick (event:MouseEvent):void { trace("click!!!!"); event.target.y += 2; event.target.x -= 2; } instanceName.buttonMode = true;