The only problem is I have never been able to get
object.children.length to work without an error.

I've tried it on the obj loader:
var obj1:Object3DLoader = Obj.load("assetts/teapot_1.obj");
trace(obj1.children.length);
and it results in child.length of 1 ... not sure what that implies for
just the loader ...

tried grabbing the handle and then doing it:
obj1object3d = e.loader.handle;
trace(obj1object3d.children.length);
1119: Access of possibly undefined property children through a
reference with static type away3d.core.base:Object3D.

and tried converting to mesh:
obj1mesh = (obj1object3d as ObjectContainer3D).children[0];
trace(obj1mesh.children.length);
1119: Access of possibly undefined property children through a
reference with static type away3d.core.base:Mesh.

I changed code (since only have 1 child apparently) to:

for ( var j : Number = 0; j < obj1mesh.faces.length; j++ ) {
obj1mesh.faces[j].material = texture3;}

and error popped:

TypeError: Error #1034: Type Coercion failed: cannot convert
Test67_texture3$ to away3d.materials.ITriangleMaterial.


On Apr 27, 2:49 am, routine <[email protected]> wrote:
> just try this one:
>
> var texture1 : BitemapFileMaterial = new BitmapFileMaterial( yourURL);
>
> >>>> for ( var i : Number = 0; i < object.children.length; i++ ) {
> >>>>        for ( var j : Number = 0; j <
> >>>> object.children[i].faces.length; j++ ) {
> >>>>                object.children[i].faces[j].material = texture1;
> >>>>        }
>
> this probably should work.
>
> Roland

Reply via email to