Basically, Im trying to reference the Loader3D which triggers a loaderEvent from within the function which is called.
This is where I’m at: (the bit between stars is what I’m trying to do)
private function addStaffMember():void
{
for (var i:uint = 0; i < numStaff; i++)
{
Loader3D.enableParser(OBJParser);
var staffLoader:Loader3D = new Loader3D();
staffLoader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, memberLoaded);
staffLoader.load(new URLRequest("models/staff/" +staffArray[i].obj +staffArray[i].obj +".obj" ));
_view.scene.addChild(staffLoader);
}
}
private function memberLoaded (event: LoaderEvent) :void
{
***** var staffLoader = event.Loader3D;*****
var staffMesh : Mesh;
for (var i : int = 0; i < staffLoader.numChildren; ++i)
{
staffMesh = Mesh(staffLoader.getChildAt(i));
staffMesh.geometry.scale(100);
var staffMaterials : DefaultMaterialBase = new ColorMaterial(0xfff6d9);
staffMaterials.ambientColor = 0x303040;
staffMaterials.lights = [_light];
staffMesh.material = staffMaterials;
staffMesh.addEventListener(MouseEvent3D.MOUSE_DOWN, staffClick);
staffMesh.mouseEnabled = true;
}
}
Basically, I’m trying to do the equivalent of
private function staffClick (e: MouseEvent3D):void
{
//this references the 3d object that sent the trigger
currentTarget = e.object;
}
but for a Loader event.
Any ideas?