Hello Fabrice,
It's an ObjectContainer3D. But I can't acces the mesh...
This line doesn't work : var mesh:Mesh = objectContainer3D.children
[0];
Flash says I can't convert an ObjectContainer3D in a Mesh.
Flo711
if(e.loader.handle is ObjectContainer3D){
trace('ObjectContainer3D');
var objectContainer3D = e.loader.handle as ObjectContainer3D;
var mesh:Mesh = objectContainer3D.children[0];
trace(String(mesh));
}
On 16 nov, 13:06, Fabrice3D <[email protected]> wrote:
> Hi flo711,
> The loader handle is an Object3D object. It can be a Mesh or an
> ObjectContainer3D
> If you try to access the faces array stored into a Mesh object make
> first make sure its a Mesh since
> it can be an Object3DContainer depending on the file structure and/or
> the Obj parser version.
>
> if(object3d is Mesh)
> trace((object3d as Mesh).faces.length);
>
> if its a container, and it contains only one Mesh
>
> if(object3d is ObjectContainer3D)
> var mesh:Mesh = (object3d as ObjectContainer3D).children[0];
> trace(mesh.faces.length);
>
> Fabrice
>
> On Nov 16, 2009, at 10:21 AM, Flo711 wrote:
>
> > Hello,
>
> > I used as exemple the "Lesson_Basic_03_Meshes.fla" with the turtle to
> > load an external obj file.
>
> > It works but I can't acces the faces of my object. I have added a
> > function called "onLoaderSuccess". I thought I could get the faces of
> > my object by pointing "object3d.faces" but it doesn't work. Can you
> > help me ?
>
> > function onLoaderSuccess(e:LoaderEvent):void
> > {
>
> > var object3d:Object3D = e.loader.handle as Object3D;
>
> > trace(String(object3d));
>
> > }
>
> > I have uploaded the .obj and the .mtl too. Their names are cube.obj
> > (2) and cube.mtl