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\$

2 Answers 2

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\$
1
  • \$\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, 2012 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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .