away3d/away3d-core-fp11 — Issue #170: Error with Max3DSParser and AssetLoaderContext.includeDependencies
Author: lbergman
Created: 2011-10-28 05:09:39+00:00
State: open

Using away3d-core-fp11-ea53493 I get an error when setting AssetLoaderContext.includeDependencies to false. Same code worked with old 3DS parser.

Here is an example class:
```as3
package
{
import away3d.containers.ObjectContainer3D;
import away3d.containers.View3D;
import away3d.loaders.Loader3D;
import away3d.loaders.misc.AssetLoaderContext;
import away3d.loaders.parsers.Max3DSParser;
import flash.display.Sprite;
import flash.events.Event;

public class Main extends Sprite
{
[Embed(source="../lib/shipA_3DS.3DS", mimeType="application/octet-stream")]
private var Ship:Class;

private var _view:View3D;
private var _container:ObjectContainer3D;
private var _ship:Loader3D;

public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
_view = new View3D();

addChild(_view);

_container = new ObjectContainer3D();
_view.scene.addChild(_container);
_view.width = 1024;
_view.height = 600;
loadShip();
}

private function loadShip():void
{
var assetLoaderContext:AssetLoaderContext = new AssetLoaderContext();
assetLoaderContext.includeDependencies = false;
_ship = new Loader3D(false);
_ship.loadData(new Ship(), assetLoaderContext, null, new Max3DSParser());
}
}

}
```

And here is the stack trace:
```TypeError: Error #1009: Cannot access a property or method of a null object reference.
at away3d.loaders.parsers::Max3DSParser/finalizeCurrentMaterial()[C:\Users\Spindrift\Documents\3DSTest\src\away3d\loaders\parsers\Max3DSParser.as:523]
at away3d.loaders.parsers::Max3DSParser/proceedParsing()[C:\Users\Spindrift\Documents\3DSTest\src\away3d\loaders\parsers\Max3DSParser.as:115]
at away3d.loaders.parsers::ParserBase/onInterval()[C:\Users\Spindrift\Documents\3DSTest\src\away3d\loaders\parsers\ParserBase.as:305]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
```

Tried with a couple of models, and both result in the same error:
http://www.turbosquid.com/3d-models/free-python-battlecruiser-3d-model/353648
http://www.turbosquid.com/FullPreview/Index.cfm/ID/531813