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