Newbie: AssetLibrary.loadData() throws stream error?

Software: Away3D 4.x

Hidden, Newbie
Posted: 14 March 2014 03:28 PM   Total Posts: 5

Im trying to load an embeded file.obj with AssetLibrary.loadData(), but it throws

[Fault] exception, information=Error: Error #2032: Stream Error. URL: app:/file.mtl

Could someone help please?

Heres my code:

[Embed(source="../stuff/file.obj",mimeType="application/octet-stream")]
  
public var FileMesh:Class;
  
  private var 
_view:View3D;
  private var 
_mesh:Mesh;
  private var 
_loader:Loader3D;
  private var 
_color:ColorMaterial;
  
        public function 
Main()
        
{
   _view 
= new View3D();
   
_view.camera.= -200;
   
_view.camera.lookAt(new Vector3D());
   
   
AssetLibrary.enableParser(OBJParser);
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);
      
AssetLibrary.loadData(FileMesh);
   
   
addChild(_view);
        
}
  
  
private function onAssetComplete(e:AssetEvent):void 
  {
   trace
("Asset complete");
  
   

Avatar
mrpinc, Sr. Member
Posted: 14 March 2014 07:59 PM   Total Posts: 119   [ # 1 ]

I don’t really work with the loadData() method as I load the actual files at runtime.  But you might want to try using the basic 3ds loader example in the AwayExamples github repo.  Just replace the model in that example with yours and of course make sure it is using the correct parser.  If that fails then it is most likely something to do with your model not being exported correctly - or at least not in a way that away3d comprehends.

   

Mr Margaret Scratcher, Sr. Member
Posted: 14 March 2014 08:11 PM   Total Posts: 344   [ # 2 ]

I seem to recall having a similar error, which was caused by either a case sensitivity issue, or having spaces in my file name…

failing that, the obvious thing would be whether your .mtl file is present, and at the level that it was generated -ie if it was in the same folder as the .obj then it needs to be there if you move the obj.

   

Hidden, Newbie
Posted: 14 March 2014 08:44 PM   Total Posts: 5   [ # 3 ]

Thank you @mrpink,

Ill give that a shot.

@Mr M. Scratcher,

sorry for beeing a noob on this, but i dont have a mlt file, only a blender generated a obj, embeded in my class, as you can see above…

   

Hidden, Newbie
Posted: 14 March 2014 09:51 PM   Total Posts: 5   [ # 4 ]

I did it the way mrpink said and found out, that mtl/obj seems to cause problems commonly, so i exported a .3ds from blender instead and it works fine for me.

Thanks for your replies!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X