Hi,
I am getting a series of errors using the new gold release that I don’t get when running the code using a version downloaded from the master branch on GitHub a few days ago.
The code, shown below, attempts to load an .obj file, attached, which I exported from PreFab 2.116.
private function initObjects():void {
ship = new ObjectContainer3D();
view.scene.addChild(ship);
Loader3D.enableParser(OBJParser);
loaderAnchor = new Loader3D(false, null);
loaderAnchor.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onAnchorComplete);
loaderAnchor.addEventListener(LoaderEvent.LOAD_ERROR, onResourceLoadingError);
loaderAnchor.load(new URLRequest("assets/anchor/Anchor.obj"));
loaderAnchor.scale(1);
}
private function onAnchorComplete(event:LoaderEvent):void
{
loaderAnchor.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, onAnchorComplete);
loaderAnchor.removeEventListener(LoaderEvent.LOAD_ERROR, onResourceLoadingError);
var m:Mesh = initMesh(loaderAnchor, 0, 1, mirror);
MeshHelper.recenter(m, false);
}
private function initMesh(loader:Loader3D, e:Number, trans:Number, mirror:Boolean):Mesh {
var m:Mesh;
if (loader.getChildAt(0) is Object3D) {
if(mirror){
Mirror.apply(loader, "z", false, true);
}
m = loader.getChildAt(0) as Mesh;
createMaterials(m, m.material as TextureMaterial, e, trans);
m.mouseEnabled = false;
}
ship.addChild(loader);
objectsLoaded ++;
objectsPercent = (objectsLoaded / objectsTotal) * 100;
return m;
}
The error message I get is:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at away3d.tools.commands::Mirror$/build()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dtoolscommandsMirror.as:215]
at away3d.tools.commands::Mirror$/apply()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dtoolscommandsMirror.as:54]
at away3d.tools.commands::Mirror$/apply()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dtoolscommandsMirror.as:58]
at Main/initMesh()[C:inetpubwwwrootaway_4_hms_surprise - newsrcMain.as:1594]
at Main/onAnchorComplete()[C:inetpubwwwrootaway_4_hms_surprise - newsrcMain.as:753]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at away3d.containers::ObjectContainer3D/dispatchEvent()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dcontainersObjectContainer3D.as:668]
at away3d.loaders::Loader3D/onResourceComplete()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersLoader3D.as:321]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at away3d.loaders::AssetLoader/retrieveNext()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersAssetLoader.as:254]
at away3d.loaders::AssetLoader/retrieveNext()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersAssetLoader.as:251]
at away3d.loaders::AssetLoader/retrieveNext()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersAssetLoader.as:251]
at away3d.loaders::AssetLoader/retrieveNext()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersAssetLoader.as:251]
at away3d.loaders::AssetLoader/onRetrievalComplete()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersAssetLoader.as:481]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at away3d.loaders.misc::SingleFileLoader/onParseComplete()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersmiscSingleFileLoader.as:416]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at away3d.loaders.parsers::ParserBase/finishParsing()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersparsersParserBase.as:446]
at away3d.loaders.parsers::ParserBase/onInterval()[C:inetpubwwwrootaway_4_hms_surprise - newsrcaway3dloadersparsersParserBase.as:421]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
If I comment out the line
Mirror.apply(loader, "z", false, true);
I get the following error when view.render() is invoked.
Does anyone have any ideas?