Hi !
First, sorry for my english.
As you know, I’d like to dispose a mesh and replace it. In my example I tried to replace it by the same one. I used 2 functions :
first one:
public function disposemodel(model:Loader3D)
{
var j:int = 0;
var numChil:uint = model.numChildren;
var mesh:Mesh;
var texMat:TextureMaterial;
for (j = 0; j < numChil2; ++j)
{
mesh = Mesh(model.getChildAt(j));
texMat = mesh.material as TextureMaterial;
texMat.texture.dispose();
texMat.dispose();
texMat=null;
mesh.geometry.dispose();
mesh.dispose();
model.removeChild(mesh);
mesh=null;
}
}
and this one :
//var tete: Loader3D=new Loader3D();
public function loadmodel():void
{
tete.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onModelLoaded);
tete.load(new URLRequest(obj.addressmodel));
}
function onModelLoaded(e : LoaderEvent):void
{
tete.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, onModelLoaded);
_view.render();
}
I created a button:
disposemodel(tete);
loadmodel();
Each time I click the button, memory “grows up” :s . First time my mesh is replaced, but at the second click, all the other children of the container 3d disappear (the replaced mesh is still visible).what’s going on?
Thank you for any help you may provide to me.