k, looked at parser and it was very easy to let it load your file even if its a 
faulty formating

uploaded fix, update from svn 
add this code snippet in your class. It will display your file.

make sure the camera distance to the mesh + lens.far is set accordingly
                         
                        
ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED, 
onResourceRetrieved);
                        
ResourceManager.instance.addEventListener(LoaderEvent.LOAD_ERROR, 
onResourceLoadingError);
                        
ResourceManager.instance.addEventListener(LoaderEvent.LOAD_MAP_ERROR, 
onResourceMapsLoadingError);
                        
                        var url:String = "pathtoyourfiles/obj10/obj10.obj";
                        
                        ResourceManager.instance.getResource(url);
                         
                }
                 
                private function onResourceLoadingError(e:LoaderEvent) : void
                {
                         trace("model load failed: ["+e.url+"]");
                }
                
                private function onResourceMapsLoadingError(e:LoaderEvent) : 
void
                {
                         trace("a map failed to load in this model: 
["+e.url+"]");
                }
                
                
                private function onResourceRetrieved(e:ResourceEvent) : void
                {
                         trace("file loaded");
                        /*
                        insert here a map update if no mtl was provided 
                        case embedded map
                        BitmapMaterial(e.resource.material).bitmapData = new 
MyDiffuseMap().bitmapData;
                        custom map
                        BitmapMaterial(e.resource.material).bitmapData = new 
BitmapData(256,256, false, 0xFF0000);
                        */

                        _view.scene.addChild(e.resource);
                }
                 

cheers,

Fabrice




On Mar 30, 2011, at 7:56 AM, Paweł Stanisławczuk wrote:

> Hi
> 
> I'm trying to load my obj files into new Away3d 4.0 but with no luck.
> I've imported them into prefab (are displayed properly) and export.
> 
> Even then they fail to load.
> 
> I'm using LoaderOBJTest as base for testing.
> It stops at: ResourceManager line 194 with: "Unespected parser error";
> 
> I also tried:
> _container =
> ObjectContainer3D(ResourceManager.instance.getResource("head/
> head.obj"));
> 
> But even the LoaderOBJTest wont compile leaving me with "parsing
> error".
> 
> In Away3D 3.x my obj worked OK.
> 
> My files:
> http://www.todesign.pl/obj10.zip
> 
> P.

Reply via email to