I'm using away3d in an Adobe Air application. This revealed a bug that
doesn't occur in Flash or Flex because Flash and Flex handle their
events a bit different. However, in case of a very simple object and a
really fast computer, this error might occur in Flash or Flex as well.
Here's what I'm trying to do:
// Create an Object3DLoader
var loader:Object3DLoader = new Object3DLoader();
// Load the object
loader = Obj.load("myObjFile.obj", {material:null, scaling:20,
bothsides:false});
// Add an addOnSuccess event handler
loader.addOnSuccess(_addOnSuccessHandler);
On line 3 I'm adding an eventHandler to the loader instance. In Adobe
Air the event's not fired because the loader's finished loading and
parsing before the eventHandler's been added.
This problem could be fixed by adding the EventListener to the loader
object before the load method is called, like this:
// Create an Object3DLoader
var loader:Object3DLoader = new Object3DLoader();
// Add an addOnSuccess event handler
loader.addOnSuccess(_addOnSuccessHandler);
// Load the object
loader = Obj.load("myObjFile.obj", {material:null, scaling:20,
bothsides:false});
This won't help because the loader instance is being overwritten by
the result object of the static Obj.load method.
Any help would be appreciated.
Regards,
Sebastiaan