Accessing mesh material in an ObjectContainer? urgent!

Software: Away3D 4.x

edgar, Member
Posted: 05 April 2012 12:21 PM   Total Posts: 52

How can I access the material of a certain mesh of an ObjectContainer in an array., e.g. changing the material of cubeFront of Cubes[23]?

code attached.

 

File Attachments
code.as  (File Size: 3KB - Downloads: 218)
code.as  (File Size: 3KB - Downloads: 240)
   

Vice, Member
Posted: 05 April 2012 12:45 PM   Total Posts: 58   [ # 1 ]

(cubes[23] as Mesh).material = ......

   

edgar, Member
Posted: 05 April 2012 01:23 PM   Total Posts: 52   [ # 2 ]

Sorry, but this does not work.

I have found a code to replace this cube:
cubesContainer.addChild(imageCube2);
 
  imageCube2.position = cubesContainer.getChildAt(20).position;
  imageCube2.rotationY = cubesContainer.getChildAt(20).rotationY;
  imageCube2.rotationZ = cubesContainer.getChildAt(20).rotationZ;
  imageCube2.rotationX = cubesContainer.getChildAt(20).rotationX;
  cubesContainer.getChildAt(20).dispose();

but I do not know how simply replace just the material of the front plane.

Any idea?

And how do I make the faces mouseEnabled again?

   

edgar, Member
Posted: 05 April 2012 02:35 PM   Total Posts: 52   [ # 3 ]

I have found the solution:
Define the cube as Mesh.
And accessing the material via
Cubes[22].getChildAt(0).material = FrontTexture3;

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X