Mouse position
Code Actionscript 2.0
Instance action
onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
Code Actionscript 3.0
addEventListener(Event.ENTER_FRAME, enterFrame); function enterFrame(event:Event) { square.x = mouseX; square.y = mouseY; }
Description
The square follows the mouse by positioning itself based on the coordinates of the mouse.
Download
Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File