Friday, February 13, 2009

Mouse

Hey guys, here are some cool stuff you can do with your mouse on flash:

-Changing the Mouse: In order to change the mouse ( you may have seen this in games), you should make the movie clip you want to be the mouse, and type this actions on it:

onClipEvent (load) {
startDrag(this, true);
Mouse.hide();
this.swapDepths(9999);
}

it tells to make the movieclip to be "dragged" by the mouse, then it hides the mouse, and finally place it over everything else.

- Tell the mouse coordinates: You can make a text box that tells you the mouse coordinates easily. Type this on the main timeline:

watchMouse = new Object();
watchMouse.onMouseMove = function() {
displayMouse_txt.text="The mouse X position is "+_xmouse+newline;
displayMouse_txt.text+="The mouse Y position is "+_ymouse;
};
Mouse.addListener(watchMouse);

Now make a big dynamic text box and give it the instance name of "displayMouse_txt"
That's it !

Now watch an exampleof what you can do with what you learned on this post:





0 comments:

Post a Comment