View Full Version : mouse position
toshesh
06-05-2003, 07:26 AM
Hi,
I want to be able to continuously display (refreshing) the x,y positions of the mouse in a textfield. could anyone give me an answer quickly?
thanks in advance!!!
CyanBlue
06-05-2003, 07:35 AM
Howdy...
Check out the _xmouse and _ymouse properties... ;)
toshesh
06-05-2003, 08:02 AM
Hi CyanBlue,
I've tried the _xmouse, _ymouse but they only show the coordinates once and wont change. I need to refresh as I move the mouse.
CyanBlue
06-05-2003, 08:12 AM
That's why your gotta put that code in the onEnterFrame handler... ;)_level0.onEnterFrame = function ()
{
trace(_level0._xmouse + " : " + _level0._ymouse);
someTextField.text = _level0._xmouse + " : " + _level0._ymouse;
}
toshesh
06-05-2003, 09:35 AM
Thanks for your help!!
I don't think I've got this fully right yet... I have a movie clip on layer called "DropDown" and the instance of the movie clip is called "bar".
_root.onClipEvent.enterFrame() {
@@@trace(_level0._xmouse + " : " + _level0._ymouse);
_root.mname = _level0._xmouse;
_root.loc = _level0._ymouse;
}
CyanBlue
06-05-2003, 08:10 PM
Try this sample...
toshesh
06-06-2003, 02:11 AM
thanks it works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
TriKri
12-18-2007, 04:43 PM
Do you have to use _level0? Say that you actually got two levels, is there any difference between _level0._xmouse and _level1.xmouse? I only have one level in my project so for me _level0 is the same as _root, I guess? and if you are inside a movieclip, is there any difference between this._xmouse (or just _xmouse) and _root._xmouse?
raubana
12-21-2007, 04:37 PM
It's easy! just make two dynamic text fields on a one-frame movie. lable one as _xmouse and the other as _ymouse. If it dousn't work, put "_root." in front of each name. Kudos!:p
minthu
12-22-2007, 07:15 AM
Create one text field and give an instance name (e.g. yourtextinstance) on the root timeline and put the following codes on the layer actions.
onMouseMove = function ()
{
trace(_xmouse + " | " + _ymouse);
yourtextinstance.text = "x: " + _xmouse + " | y: " + _ymouse;
}
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.