doomtoo
July 31st, 2009, 03:10 PM
There's two possible ways I can see of trying to detect when the mouse is over/clicked something.
1. Add a mouse listener to the stage, then determine what the mouse is over depending on what is on the screen at the time/visible.
2. Adding mouse listeners for each object that is visible, and removing them when the object is no longer visible
Number 2 is much easier to implement, but would having a lot of mouse listeners cause it to be slower than using my own code to try to figure out which object it is over, or would the built in code be faster?
1. Add a mouse listener to the stage, then determine what the mouse is over depending on what is on the screen at the time/visible.
2. Adding mouse listeners for each object that is visible, and removing them when the object is no longer visible
Number 2 is much easier to implement, but would having a lot of mouse listeners cause it to be slower than using my own code to try to figure out which object it is over, or would the built in code be faster?