Author Topic: 3D && 2D mouse event problem?  (Read 202 times)

chao chen   «   on: April 27, 2012, 04:50:32 AM »
I have a scene with a 2D button and 3D scene below.
When I click 2D button, it will trigger 3D events.
2048 has this problem while 2047 is OK.

Ivan Vodopiviz   «   Reply #1 on: April 27, 2012, 12:11:06 PM »
Hi,

Input3D events are processed using the Stage. To filter the results, you can use Input3D.enableEventPhase. Using that, if some event was catched by another movieclip before reaching the stage, Input3D will ignore it. In the same way, setting it to false will make all events always reach Input3D (because they all reach the Stage).

But even if you have enableEventPhase set to false, you can always stop the event by hand. For example, if you have a 2d button, in your click handler you can do something like this:

private function buttonClickHandler( e:MouseEvent ):void
{
    e.stopPropagation();
    // your code and stuff
}

In general terms, event flow in Flash is a little convoluted, you can see more details here.

Regards,

georgefloros floros   «   Reply #2 on: July 04, 2012, 06:27:55 AM »
Hi Ivan,

I have the same problem and nothing from above worked,it seems that it's 2048v problem..

Ivan Vodopiviz   «   Reply #3 on: July 04, 2012, 12:03:40 PM »
Hi,

This has been really difficult for us to track down. Whenever changes are made, half the users are happy while the other half isn't :P Please take a look at the code in this link.

The results I get from this code is that if I click the cube, I get a trace saying "Cube Clicked" and if I click the square sprite, I only get a trace saying "Square Clicked", even if I click on a part that overlaps with the cube.

If I add Input3D.enableEventPhase = false; into the mix, if I click the square where it overlaps with the cube, both messages are triggered, which is correct.

Would you mind testing this to confirm my results?

georgefloros floros   «   Reply #4 on: July 05, 2012, 04:39:07 AM »
Hi Ivan ,
I test your code ,every thing works fine.
But the problem appears when you assign a Scene3D.UPDATE_EVENT to the scene.
Check my code please 
http://pastebin.com/jjb763WR

Ivan Vodopiviz   «   Reply #5 on: July 05, 2012, 11:12:42 AM »
I see. mouseHit only checks if the mouse button has been hit, it doesn't check where. So if you click the mouse, the check will be true no matter your eventPhase settings. You can however, filter the results like this:

private function sceneUpdate( e:Event ):void   
{
    if ( Input3D.eventPhase > EventPhase.AT_TARGET )
        return;
           
    if( Input3D.mouseHit ) 
    {     
        trace( "Input3D.mouseHit" );
    }
}

Please se if this works for you.

Regards,

georgefloros floros   «   Reply #6 on: July 06, 2012, 05:30:19 AM »
It works fine when you click on the sprite  but not on the cube.
Anyway i will find a work around.
Keep on the good work Flare3d Team the engine is awesome!!
The company that i work just bought the commercial license ,and the Flare3d studio is fantastic!!