Hey,
I am having a problem loading an embedded object file. (As of today I am using the latest Away3D 4 version)
The model, texture and material file work if I load them directly via the load functionality.
However, for this project I need to embed them.
// model
[Embed(source = "/../assets/models/icecube/ice_cube01_lg.obj", mimeType = "application/octet-stream")]
private var IceCubeModel:Class;
// material
[Embed(source="/../assets/models/icecube/ice_cube01_lg.mtl", mimeType = "application/octet-stream")]
private var IceCubeMaterial:Class;
// texture
[Embed(source="/../assets/models/icecube/ice01.png")]
private var IceCubeBitmap:Class;
Then, when I try to load it I do the following:
var context : AssetLoaderContext = new AssetLoaderContext();
context.mapUrlToData('ice_cube01_lg.mtl', new IceCubeMaterial());
context.mapUrlToData('ice01.png', new IceCubeBitmap());
Parsers.enableAllBundled();
m_Loader3D = new Loader3D(false);
m_Loader3D.addEventListener(AssetEvent.ASSET_COMPLETE, onAssetRetrieved);
m_Loader3D.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
m_Loader3D.addEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
m_Loader3D.loadData(new IceCubeModel(), context);
When I check onAssetRetrieved I can see that the meshes load fine, but it bombs out the moment the first texture is loaded.
This is where and how it crashes:
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.
It points to the following file / line:
Line 191 “_timer.start();” in function “resumeParsingAfterDependencies()” in file “ParserBase.as”.
I have attached the files in question. As said, they do work fine when loaded directly, just embedding fails. I’ve tried and tried, but don’t seem to be any closer to a solution so far.
If I remove the texture reference from the “mtl” file it will load, but obviously without the texture.
Any ideas what I am doing wrong?
Many thanks in advance!