Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a problem with Mouse interaction and Stage3D.

The only way I found to register to listen to mouse clicks and interact with Stage3D, is to add a mouse eventListener directly to the .stage.

However this will result in any time i click anywhere in the flash application the mouse click will fire, even if there is an overlaid 2D menu where the user intended to click.

IE I have a 3D application running in the background, which listens to clicks, and I have some floating User Interface elements in the foreground, and ideally if I clicked a button in the foreground, then that would NOT fire a click event that the Stage3D would register.

Any idea how to solve this problem?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You can read the Mouse Coordinate at the click and check it against the bounds from your interface. If the Mouse is on the interface do nothing in stage...

share|improve this answer
    
I ended up doing this, just check each click against an array of 'exclude areas'. it feels pretty awkward, but it works. –  Martin K Oct 4 '12 at 11:42
add comment

You could also call the stopImediatePropagation on your UI elements, but that will probably give you some other problems later on.

But I assume it is better than having a list of items to be ignored.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.