My guess is I am doing something wrong. When I load 3 .3ds files at the same time it will crash out in AIR in debug mode but work fine when I publish normally. I am building the project in Flash Builder 4.5.
Here is what I am doing now:
var par:Max3DSParser = new Max3DSParser();
var loader:Loader3D = new Loader3D();
ramp = new ObjectContainer3D();
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, function(e:LoaderEvent):void
{
var mesh:Mesh = Mesh(ramp.getChildAt(0));
mesh.material = dots
mesh.subMeshes[0].scaleU = 3;
mesh.subMeshes[0].scaleV = 15;
mesh.position = new Vector3D(0,-0,-100);
trace("Ramp Loaded")
slingShotLoader.load(new URLRequest("assets/game/slingArm.3DS"),slingShotPar);
});
loader.load(new URLRequest("assets/game/ramp.3DS"),par);
ramp = loader;
var slingShotPar:Max3DSParser = new Max3DSParser();
var slingShotLoader:Loader3D = new Loader3D();
slingShot = new ObjectContainer3D();
slingShotLoader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, function(e:LoaderEvent):void
{
var mesh:Mesh = Mesh(slingShot.getChildAt(0));
mesh.material.lights = [light1, light2, light3];
// load sling after sling handle is loaded, loading at same time caused debugger to crash
slingLoader.load(new URLRequest("assets/game/slingCup.3DS"),slingPar);
});
slingShot = slingShotLoader;
var slingPar:Max3DSParser = new Max3DSParser();
var slingLoader:Loader3D = new Loader3D();
sling = new ObjectContainer3D();
slingLoader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, function(e:LoaderEvent):void
{
var mesh:Mesh = Mesh(sling.getChildAt(0));
mesh.material.lights = [light1, light2, light3];
mesh.rotationY = 180;
});
sling = slingLoader;
So to fix it I am daisy-chaining the load of each file’s RESOURCE_COMPLETE.
Am I doing this wrong? Should I be merging this all into one Loader3D?