Hey guys,
I’m searching in forums many many hours but can’t find an answer.
I’m programming a test application to check out the performance of Stage3D. During the performancetest, Flash automatically adds Cubes on the Stage and rotate them.
With the cube Primitive it works very well. In a function (attachModel), called every second, I create, position and scale a Cube by saying
_cube = new Cube();
_view.scene.addChild(_cube);
Now I want to load a model in my constructor function and create an instance of it in the same function, like I did it with the cubes. This is what I have written:
//constructor Function....
Loader3D.enableParser(Max3DSParser);
_loader = new Loader3D();
var _request:URLRequest = new URLRequest("../assets/utah_teapot/utah_teapot_992.3ds");
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete); _loader.load(_request);
//attachModel Function...
var _model:Mesh = _loader.getChildAt(0) as Mesh;
_model.x = 0;
_model.y = 0;
_model.z = 0;
_model.scale(1);
When i first call attachModel it works very well. I see my teapot.
At the second call, the Flash Debugger says:
" RangeError: Error #1125: The index 0 is out of range 0."
I found out, that when I trace _loader.numChildren Flash says that at the first call the number is 1. At the second call it’s 0. And I don’t know why the model is out of the loader.
So finally, my question is:
can I load a 3ds-model once and use it many times, without loading it again for each function-call?!
P.S. the Away3D-Exporter Classes don’t work for Away3D 4, am I right?