03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

coords_txt._x = _xmouse;<br />

coords_txt._y = _ymouse;<br />

};<br />

Mouse.addListener(mouseListe(er);<br />

See also<br />

_xscale (TextField._xscale property), _y (TextField._y property), _yscale<br />

(TextField._yscale property)<br />

_xmouse (TextField._xmouse property)<br />

public _xmouse : Number [read-only]<br />

Returns the x coordinate of the mouse position relative to the text field.<br />

Note: This property is supported in Flash Lite only if System.capabilities.hasMouse is<br />

true or System.capabilities.hasStylus is true.<br />

Example<br />

The following example creates three text fields on the Stage. The mouse_txt instance displays<br />

the current position of the mouse in relation to the Stage. The textfield_txt instance<br />

displays the current position of the mouse pointer in relation to the my_txt instance. Add the<br />

following ActionScript to a FLA or ActionScript file:<br />

this.createTextField("mouse_txt", this.getNextHighestDepth(), 10, 10, 200,<br />

22);<br />

mouse_txt.border = true;<br />

this.createTextField("textfield_txt", this.getNextHighestDepth(), 220, 10,<br />

200, 22);<br />

textfield_txt.border = true;<br />

this.createTextField("my_txt", this.getNextHighestDepth(), 100, 100, 160,<br />

120);<br />

my_txt.border = true;<br />

var mouseListener:Object = new Object();<br />

mouseListener.onMouseMove = function() {<br />

mouse_txt.text = "MOUSE ... X:" + Math.round(_xmouse) + ",\tY:" +<br />

Math.round(_ymouse);<br />

textfield_txt.text = "TEXTFIELD ... X:" + Math.round(my_txt._xmouse) +<br />

",\tY:" +<br />

Math.round(my_txt._ymouse);<br />

}<br />

Mouse.addListener(mouseListener);<br />

652 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!