Same problem and this works fine. One question though : why can't I find Loader3D.loadGeometry on http://away3d.com/livedocs/ ?
Thanks to the Away3D staff for all the great work ! Aurelien On 24 jan, 19:52, Fabrice3D <[email protected]> wrote: > try > > var loader:Loader3D = new Loader3D(); > loader.addOnSuccess(onLoadedComplete); > loader.addOnError(onLoadedError); > > var initO:Object = {useGroups:true}; // only if you want to see the "g" tag > of obj file being handled as ObjectContainer3D > var parser: Obj = new Obj(initO); > > loader.loadGeometry(urlofyourobjfile, parser); > > Fabrice > > On Jan 24, 2010, at 2:08 PM, Sylvain Godbert wrote: > > > Hi All, > > > I have successfully imported a 3ds max model in the following way : > > > max3ds = new Max3DS(); > > loader = new LoaderCube(); > > loader.addOnSuccess(onSuccess); > > loader.loadGeometry("assets/etoile_3ds/etoile.3ds", max3ds); > > scene.addChild(loader); > > > The callback for "onSuccess" is : > > > private function onSuccess(event:Event):void > > { > > model = loader.handle as ObjectContainer3D; > > model.scale(5); > > } > > > This works perfectly. > > > Now, I am doing the very same thing, but I am loading the object as > > *.obj : > > > obj = new Obj(); > > loader = new LoaderCube(); > > loader.addOnSuccess(onSuccess); > > loader.loadGeometry("assets/etoile_obj_prefab/myModel/myModel.obj", > > obj); > > scene.addChild(loader); > > > private function onSuccess(event:Event):void > > { > > model = loader.handle as ObjectContainer3D; > > model.scale(5); > > } > > > The problem is that "loader.handle as ObjectContainer3D" returns > > "null" and therefore makes the flash crash. Although, the model is > > successfully displayed in the scene (the geometry and the texture). > > This leads me to think that the loading does work fine, but for some > > reasons, "onSuccess" is called before the mesh is properly loaded. > > > Am I loading my obj in the wrong way ? Is there something specific to > > do when loading an *.obj file ? > > > Note : I am using Away3D from google.code (I downloaded a version 2 > > days ago) > > > Cheers > > > Sylvain
