Thursday, December 24, 2009

How can I detect the mouse position in Flash Pro CS3/CS4?

I'm making a flash game for an individual project in my programming class. the game is a shooting game, so naturally i need mouse commands like clicking and mouse location detection.





can you show me the code for these operations and possibly make some suggestions?How can I detect the mouse position in Flash Pro CS3/CS4?
Hi,





Code samples will have different syntaxes depending on what version of actionscript you are using.





One way to approach the game is by attaching event listeners to objects(e.g movieclips).





They will listen for mouse events such as 'MouseOver' to simulate being on target and 'MouseDown' to simulate a hit.





In this way, the movie clips can detect whether the mouse is on them or not.

No comments:

Post a Comment