I am using Away3D 4..
So my setup code lives in the createChildren() method of a UIComponent. I’ve tested, and it’s only ever run once per UIComponent in this setup. The spark.View it lives in is destroyed and so this component is created every time the user goes to the game view.
_view = new View3D();
_view.backgroundColor = 0xff0000;
_view.width = this.width;
_view.height = this.height;
addChild(_view);
_view.camera.lens = new OrthographicLens(_view.height);
var mat:Matrix3D = new Matrix3D();
mat.appendTranslation(_view.width/2,-_view.height/2,0);
mat.appendScale(1,-1,1);
_view.camera.transform.append(mat);
Basically I’m moving the origin of the ortho projection to the top left and flipping the y (using it for 2d).
Now this works great - ONCE.
If I don’t do any disposing, I get multiple copies of this with the added objects until it bombs out with “too many stage3d…” error.
If I dispose between views, I never get the too many stage3d errors, but none of the added objects are visible (only the red background.)
How can I debug this? It seems some state is being held onto despite the fact that I am disposing.