Thank you SO much, Jensa!! That was it!!! :))) I have to read a bit more about what is the main "loop", the timing of things, and be careful with event listeners.
Free graphic or model work is yours if you ever need it. :) Should I delete my extensive diatribes of bad code in these threads, etc and post corrected code in file area? On Apr 26, 8:05 am, Jensa <[email protected]> wrote: > Taking a quick look at the code now. There's a major bug there. You > have three separate listeners that will call your onLoaderSuccess one > time each. This is bound to screw things up when you do like this > before the other two objects have downloaded: > > obj1object3d = e.loader.handle; // The one calling > obj2object3d = e.loader.handle; // Not yet loaded > obj3object3d = e.loader.handle; // Not yet loaded > either > > You'll easily see this by placing a trace statement in the > onLoaderSuccess method. To solve the issue and make everything work as > it should, just make sure each object calls it's own listener like > this: > > private function initObjects():void > { > var material:BitmapFileMaterial = new > BitmapFileMaterial("assetts/ > teapot_1.jpg"); > var material2:BitmapFileMaterial = new > BitmapFileMaterial("assetts/ > teapot_2.jpg"); > var material3:BitmapFileMaterial = new > BitmapFileMaterial("assetts/ > teapot_3.jpg"); > > var obj1:Object3DLoader = > Obj.load("assetts/teapot_1.obj", > { material:material } ); > var obj2:Object3DLoader = > Obj.load("assetts/teapot_2.obj", > {material:material2 } ); > var obj3:Object3DLoader = > Obj.load("assetts/teapot_3t.obj", > {material:material3 } ); > obj1.addOnSuccess(onLoaderSuccess1); > obj2.addOnSuccess(onLoaderSuccess2); > obj3.addOnSuccess(onLoaderSuccess3); > } > > private function onLoaderSuccess1(e:LoaderEvent):void > { > obj1object3d = e.loader.handle; > > obj1mesh = (obj1object3d as > ObjectContainer3D).children[0]; > > scene.addChild(obj1object3d); > } > private function onLoaderSuccess2(e:LoaderEvent):void > { > obj2object3d = e.loader.handle; > > obj2mesh = (obj2object3d as > ObjectContainer3D).children[0]; > > scene.addChild(obj2object3d); > } > private function onLoaderSuccess3(e:LoaderEvent):void > { > obj3object3d = e.loader.handle; > > obj3mesh = (obj3object3d as > ObjectContainer3D).children[0]; > > scene.addChild(obj3object3d); > } > > Hope that helps! > > J > > On Apr 26, 1:11 pm, jojo <[email protected]> wrote: > > > > > Sorry to be such a pain but I've been banging my head all day and > > night trying to figure out why this hide object code isn't working. > > Project stuck until it works. I'm just not getting it even with > > suggested changes ... > > > Can someone please compile the project to see if it also fails for > > you?http://groups.google.com/group/away3d-dev/web/Test67.zip > > > or at least look at the recent code to see if the logic is > > sound?http://groups.google.com/group/away3d-dev/web/Test67.as > > > I'll even do some graphics or modelling work for anyone who can solve > > this ...- Hide quoted text - > > - Show quoted text -
