Hey Alex this will most likely be because you are using screenZOffset, which is only active when you use ownCanvas = true;
screenZOffset affects the order items are rendered, but it will also affect mouse events as anything with a screenZ coord less than that will obstruct 3d mouse events i would try removing the screenZOffset from your example to see if you still have the problem atb Rob On Wed, Jan 13, 2010 at 4:49 PM, Alex Rico <[email protected]> wrote: > Hi: > > i'm having problems with the owncanvas property. When i try to add a > mouse3devent3d listener it doesn't work if the property owncanvas is > true. > > this is my function: > > private function windowMouseDown(e:MouseEvent3D):void > { > trace("click on window"); > } > > this code works: > > var window:Plane = new Plane({material:windowMaterial, height:100, > width:100, segmentsH:4, segmentsW:4, ownCanvas:false}); > window.bothsides=true; > window.screenZOffset=-1000; > view.scene.addChild(window); > window.addOnMouseDown(windowMouseDown); > // or window.addEventListener(MouseEvent3D.MOUSE_DOWN, > windowMouseDown); > > this doesn't works: > > var window:Plane = new Plane({material:windowMaterial, height:100, > width:100, segmentsH:4, segmentsW:4, ownCanvas:true}); //now i set > ownCanvas to true > window.bothsides=true; > window.screenZOffset=-1000; > view.scene.addChild(window); > window.addOnMouseDown(windowMouseDown); > // or window.addEventListener(MouseEvent3D.MOUSE_DOWN, > windowMouseDown); > > > I tried to add the object to and object container. > > this code works: > > windowContainer=new ObjectContainer3D(); > view.scene.addChild(windowContainer); > var window:Plane = new Plane({material:windowMaterial, height:100, > width:100, segmentsH:4, segmentsW:4, ownCanvas:false}); > window.bothsides=true; > window.screenZOffset=-1000; > windowContainer.addChild(window); > window.addOnMouseDown(windowMouseDown); > // or window.addEventListener(MouseEvent3D.MOUSE_DOWN, > windowMouseDown); > > this doesn't works: > > windowContainer=new ObjectContainer3D(); > view.scene.addChild(windowContainer); > var window:Plane = new Plane({material:windowMaterial, height:100, > width:100, segmentsH:4, segmentsW:4, ownCanvas:true});//now i set > ownCanvas to true > window.bothsides=true; > window.screenZOffset=-1000; > windowContainer.addChild(window); > window.addOnMouseDown(windowMouseDown); > // or window.addEventListener(MouseEvent3D.MOUSE_DOWN, > windowMouseDown); > > *in this case i can't add the event listener to the whole > objeccontainer3d because i have lots of planes (an array of planes). I > need to add the event listener to each plane. > > > What am i doing wrong? i need the onwcanvas property set to true, if i > can't add event listeners to the object while the property is false I > have a big problem. > > Thank You. > > Alex. > > -- Rob Bateman Flash Development & Consultancy [email protected] www.infiniteturtles.co.uk www.away3d.com
