0
\$\begingroup\$

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?

\$\endgroup\$
1
\$\begingroup\$

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...

\$\endgroup\$
  • \$\begingroup\$ I ended up doing this, just check each click against an array of 'exclude areas'. it feels pretty awkward, but it works. \$\endgroup\$ – Martin K Oct 4 '12 at 11:42
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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