I have seen some place x and y coordinates shown on mouse follow. As you move the mouse the coordinates changes. How is this done , if anyone can help me.
Create two textboxes on the stage.
Give one the <B>INSTANCE</B> name “x” (no quotes) and the other the <B>INSTANCE</B> name “y” (no quotes).
Add these actions to a frame…
_root.onMouseMove = function() {
_root.x.text = Math.round(_root._xmouse);
_root.y.text = Math.round(_root._ymouse);
};
That was easy. Thought the code would be more. Wll , thanx again man.
No problem, if you want easier than that, create a new document and just throw this in the first frame…
_root.createTextField("x", 1, 0, 0, 50, 20);
_root.createTextField("y", 2, 0, 0, 50, 20);
_root.onMouseMove = function() {
_root.x._x = _root.y._x=_root._xmouse+25;
_root.x._y = _root._ymouse+25;
_root.y._y = _root._ymouse+40;
_root.x.text = "X: "+Math.round(_root._xmouse);
_root.y.text = "Y: "+Math.round(_root._ymouse);
};
Then test
Is that possible. I tried but when I test my movie The numbers wont show
My movie containing the x y ac wont show the numbers when loaded into a target. why?
Refer to my previous post
lost is too good to really get this…
use
_root._xmouse and
_root._ymouse
to obtain the current coordinates of the mouse from ANYWHERE in your movie
That is what I used the first time. Only I used Math.round() to round the number so that it didn’t have 8 decimal digits
oooo!
right…
I just saw yer first post. That definetly should do the trick!
sorry beta. shudda looked a little deeper
My second one dynamically creates the two textboxes, then has them follow the mouse.
I was bored :-\
_root.createTextField("x", 1, 0, 0, 50, 20);
Why bother with x if then else x = _xmouse?!?!?
Huh? That question made no sense dude…lol.
I wrote that late last night and I can’t figure out what I said either
LOL.