how to mouseEnabled a mesh from cloned container ??

Software: Away3D 4.x

charlito, Jr. Member
Posted: 12 April 2012 02:58 PM   Total Posts: 36

hi..

my problem is that i have one containers loaded with a mesh from a .obj.
i enabled this mesh for mouseclicked.
then add an eventlistener for the contaier that has this mesh..

but when i clone this container into a second container..
the second containers dont detect the mouseDown event..

like this

mesh1.mouseEnabled true;

ocCar2 ocCar.clone() as ObjectContainer3D;
ocCar2.x+=200;    

view.scene.addChild(ocCar);
view.scene.addChild(ocCar2);
    
ocCar.addEventListener(MouseEvent3D.MOUSE_DOWN,function1);
ocCar2.addEventListener(MouseEvent3D.MOUSE_DOWN,function2); 

the second eventlistener just doesnt work..

who can i extract the mesh from the container so i could enabled??

 

 

thx alot in advance..


smile

 

 

   

ASWC, Member
Posted: 12 April 2012 06:16 PM   Total Posts: 76   [ # 1 ]

I don’t think cloning a container automatically clones all objects inside it (didn’t check but that doesn’t sound logical). So go through all objects inside it and clone them too.

   

charlito, Jr. Member
Posted: 12 April 2012 06:34 PM   Total Posts: 36   [ # 2 ]

hi.

thx for ur reply


i saw what u propose.. and they do..

i actually tryed

mesh2=ocCar2.getChildAt(0);

with no results.

but i also did a trace


trace(“this has a = “+ocCar2.getChildAt(0));

and this shows it has a mesh object within ocCar2. and when u add the
second container to the scene, u can see, its a perfect copy of what the first cointainer has.


(the code may not be exactly becouse im not im pc)


thx a lot..

but the cuestion still in the air.


smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X