I can't seem to find any of the sample movies that demonstrate this. I want to have text boxes that dynamically display the cursor's X and Y coordinates/positions in the clip. Any suggestions?
Umnbrella
Printable View
I can't seem to find any of the sample movies that demonstrate this. I want to have text boxes that dynamically display the cursor's X and Y coordinates/positions in the clip. Any suggestions?
Umnbrella
draw a dynamic text box on your main stage with varialbe name out
add the following code to a dummy MC:Code:onClipEvent(enterFrame){
_root.out="X:"+_root._xmouse+" "+"Y:"+root._ymouse;
}
Hmm if i understand your question correctly you just need to create two text boxes call one xpos and the other ypos then
onClipEvent (enterFrame) {
xpos = _root._xmouse
ypos = _root._ymouse
}
i've included a link to the sample let me know if this is what you were looking for
http://www.floppyfish.net/flash/coord.swf
Regards
Darren
So far I understand all of the logic behind what you all are suggesting (thank you, by the way), however I'm stuck on the 'onClipEvent' aspect of it. I can't seem to get the 'onClipEvent' to work without errors. Could someone kinda walk me through the steps of the dummy MC and where the code goes?
Thanks again!
Umnbrella
Nevermind..I just realized that the events have to be attached to the clips instead of objects or frames.
Thanks!
Umnbrella
Ok here we go i'll step you through a text box for the x-coord. and you should ba able to do the y part the same.Quote:
Originally posted by Umnbrella
So far I understand all of the logic behind what you all are suggesting (thank you, by the way), however I'm stuck on the 'onClipEvent' aspect of it. I can't seem to get the 'onClipEvent' to work without errors. Could someone kinda walk me through the steps of the dummy MC and where the code goes?
Thanks again!
Umnbrella
1 Start new flash file
2 insert -> new symbol call it coords and make it a movie clip
3 now inside the movie clip make a text box. make it dynamic single line and variable name xpos. re size it so it will fit enough digits set font and colour to what ever you want.
4 go back to the main movie and insert the clip from the library.
5 make sure its selected and open the actions window.
add code
onClipEvent (enterFrame) {
xpos =_root._xmouse
}
or and of the above examples.
6 Ctrl + Enter to test
all done.
Start a new flash project by going to File > New (or pressing Ctrl+N);
Open the actions panel by hitting F9;
Enter the following code:
stop();
_root.onEnterFrame = function() {
trace('mouse-x: ' + _root._xmouse + newline + 'mouse-y: ' + _root._ymouse);
}
-- End code --
Now test your movie by hitting Ctrl+Enter;
Enjoy the silence ;)