apscience
apscience

Reputation: 7253

AS3 - Detect if mouse is down, even if overlaps

I would like to know if the mouse button is down, even if another object is being clicked. How do I do that? Simply adding event listeners doesn't work as it does not trigger if something else is on top of the object.

Thanks

Upvotes: 1

Views: 3061

Answers (2)

PatrickS
PatrickS

Reputation: 9572

Add both a Click & MouseDown event listeners to the stage.

If an object is clicked , the event will bubble up to the stage so you should be able to register it and react accordingly.

You can also check the event.currentTarget property to find out where the event originated from , this should tell you if it was the stage or an object being clicked as well as where the mouse down event came from.

Upvotes: 2

ToddBFisher
ToddBFisher

Reputation: 11590

Add a mouse down event listener to the stage (or other parent of all objects in question)

Upvotes: 0

Related Questions