I can’t seem to get any models to load in any format. I’ve no idea if it’s an Away3D thing, or something related to 3D graphics in general, or something else. Here’s the code:
public override function load():void {
Parsers.enableAllBundled();
loader3d = new Loader3D();
loader3d.addEventListener(LoaderEvent.RESOURCE_COMPLETE, loadComplete);
loader3d.addEventListener(LoaderEvent.LOAD_ERROR, loadFailed);
loader3d.load(new URLRequest("assets/stall.obj"));
}
public function loadFailed(evt:Event):void {
trace(evt.formatToString);
trace('oh no, not again');
}
public override function loadComplete(evt:Event = null):void {
trace(evt.type);
}
Doing this results in an error:
[Fault] exception, information=Error: Error #2032: Stream Error. URL: file:///C|/Stuff/Away3DTest/bin/assets/.
...which is clearly not the thing I’ve asked it to look for. FlashDevelop brings up AssetLibrary.as with the cursor next to this block:
/**
* Called when a an error occurs during dependency retrieving.
*/
private function onDependencyRetrievingError(event : LoaderEvent) : void
{
// TODO: not used
//var ext:String =
event.url.substring(event.url.length-4, event.url.length).toLowerCase();
if (hasEventListener(LoaderEvent.LOAD_ERROR)){
dispatchEvent(event);
}
else throw new Error(event.message);
}
It does the same thing with 3DS files.
The files are definitely there. I can get Flash to see them with a standard Loader object. Moreover, If I try using a nonsense URL, I get the following:
[Fault] exception, information=Error: Error #2032: Stream Error. URL: file:///C|/Stuff/Away3DTest/bin/assets/nnnnnnnnnnnngh
To be clear, the files in the directory are a crossdomain.xml, stall.mtl, stall.obj, stall_please_work.3ds and texture.png. They’ve been exported from Blender. I can get them to load in preFab, so they’re perfectly sound from what I can tell.
Has anyone got any idea what I could be doing wrong here? The only example I can find for Away3D 4 uses embedded assets, and that’s not really a solution.
Thanks in advance for any help