Hi guys can anyone point me an example how to parse a local file?
I’m loading a file through FileReference then i extract the data.
What i’m experiencing is: it throws me an error when i try to load an obj file.
I understand that because it does not load the mtl file. How can i surpass this?
Thanks in advance.
Parsing OBJ and 3DSSoftware: Away3D 4.x |
||
Eduardo, Newbie
Posted: 14 June 2012 10:59 PM Total Posts: 6 |
||
Richard Olsson, Administrator
Posted: 16 June 2012 10:35 AM Total Posts: 1192 [ # 1 ] You can use AssetLoaderContext (second argument of load() and loadData() functions) to configure the loading framework not to include dependencies. myLoader.loadData(myData, new AssetLoaderContext(false)); |
||
Eduardo, Newbie
Posted: 17 June 2012 02:11 PM Total Posts: 6 [ # 2 ] Hi Richard! So i never place my model inside the scene. |
||
Richard Olsson, Administrator
Posted: 17 June 2012 02:19 PM Total Posts: 1192 [ # 3 ] Listen for the LoaderEvent.RESOUCE_COMPLETE event which will be dispatched when the entire resource (including any dependencies if you haven’t disabled them) has finished loading. |
||
Eduardo, Newbie
Posted: 17 June 2012 02:26 PM Total Posts: 6 [ # 4 ] Hi Richard thank you for you’re quick reply. So like i said i’m ripping the data as ByteArray from a FileReference file then i’m adding the ByteArray to this: public function addObject (byteArray:ByteArray):void { —— but i cant get into the onModelLoaded… private function onModelLoaded(e:LoaderEvent):void } |
||
Richard Olsson, Administrator
Posted: 17 June 2012 02:31 PM Total Posts: 1192 [ # 5 ] What you have there should work, provided that the content of byteArray is a valid file of a type that Away3D recognizes and that you have enabled the relevant parsers. You should have Parsers.enableAllBundled() (or something equivalent) somewhere in your code before you trigger the load. Have a look at the Basic_Load3DS.as example in the away3d-examples-fp11 repository on GitHub. |
||
Eduardo, Newbie
Posted: 17 June 2012 02:35 PM Total Posts: 6 [ # 6 ] Hi Richard thank you again Well i will check the example and catch you later. But if you have the time try it with an obj file. |
||
Richard Olsson, Administrator
Posted: 17 June 2012 02:43 PM Total Posts: 1192 [ # 7 ] If you can’t get it to work, please file a bug and provide your files at http://github.com/away3d/away3d-core-fp11/issues . You will have to upload your files somewhere else and link to them in the bug report. |
||
|