How to stop event bubble?event.stopPropagation() is not work.

Software: Away3D 4.x

KobeJames, Newbie
Posted: 24 June 2012 11:41 PM   Total Posts: 21

init object

var plane2:Mesh = new Mesh(new PlaneGeometry(300,300,1,1,false),redMaterial);
plane2.extra "plane2";
plane2.mouseEnabled true;
plane2.addEventListener(MouseEvent3D.MOUSE_DOWN,doubleHandler);
   
scene.addChild(plane2);
   
var 
plane3:Mesh = new Mesh(new PlaneGeometry(200,200,1,1,false),greenMaterial);
plane3.extra "plane3";
plane3.mouseEnabled true;
plane3.addEventListener(MouseEvent3D.MOUSE_DOWN,doubleHandler);
plane2.addChild(plane3);
   
var 
plane4:Mesh = new Mesh(new PlaneGeometry(100,100,1,1,false),yellowMaterial);
plane4.extra "plane4";
plane4.mouseEnabled true;
plane4.addEventListener(MouseEvent3D.MOUSE_DOWN,doubleHandler);
plane3.addChild(plane4); 

doubleHandler code:

public function doubleHandler(event:MouseEvent3D):void{
 trace
(Mesh(event.target).extra);
 
trace(Mesh(event.currentTarget).extra);
 
trace("--------------------------------");
 
event.stopPropagation();

output:

plane4
plane4
--------------------------------
plane3
plane3
--------------------------------
plane2
plane2
-------------------------------- 
   

Richard Olsson, Administrator
Posted: 25 June 2012 05:26 AM   Total Posts: 1192   [ # 1 ]

This sounds like a bug. I’ll file it myself and fix it ASAP, probably later today.

Cheers!

 

   

KobeJames, Newbie
Posted: 25 June 2012 06:14 AM   Total Posts: 21   [ # 2 ]

Okay, I’m waiting for your good news:)

 

   

KobeJames, Newbie
Posted: 25 June 2012 07:32 AM   Total Posts: 21   [ # 3 ]

Dear Richard,I think the child plane should on top of the parent plane both same z value.in another word, we can see both child plane and parent plane if child is smaller than parent.
but now, the child plane is hiden by parent plane both same z value.
Am I right? Thank you very much.

 

   

Richard Olsson, Administrator
Posted: 25 June 2012 07:58 AM   Total Posts: 1192   [ # 4 ]

I’m not sure what you mean. The hierarchy of objects should (typically) not influence what objects appear in front of others. It’s entirely up to their relative Z position in screen space, and the GPU does the sorting per pixel.

The exception is when you use alpha transparency and the objects thus have to be sorted on the CPU. In those cases, objects in the exact same screen-space Z position can be sorted differently depending on the order in which they were added to their parent (as a result of the sorting algorithm.)

 

   

KobeJames, Newbie
Posted: 25 June 2012 08:16 AM   Total Posts: 21   [ # 5 ]

There is a picture

ok,I see…. I have to type some code to change every plane’s z value,it’s that right?

 

   

Richard Olsson, Administrator
Posted: 25 June 2012 08:58 AM   Total Posts: 1192   [ # 6 ]

Yes, in a 3D engine the idea is that you position things in 3D space. Objects are not sorted in relation to the order that they were added to the scene, and the hierarchy generally has no influence on how they are depth sorted on the screen.

 

   

KobeJames, Newbie
Posted: 25 June 2012 09:12 AM   Total Posts: 21   [ # 7 ]

Thank you !

 

   

Richard Olsson, Administrator
Posted: 25 June 2012 03:06 PM   Total Posts: 1192   [ # 8 ]

Mouse events are now prevented from bubbling when using preventPropagation() as detailed in the following issue report and the commit message in the linked changeset.

https://github.com/away3d/away3d-core-fp11/issues/307

 

   

KobeJames, Newbie
Posted: 25 June 2012 03:10 PM   Total Posts: 21   [ # 9 ]

ok~thanks!

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X