Hi, I have a problem with free memory on load a model. This is my code.
loader = new AssetLoader();
loader.load(url);
loader.addEventListener(AssetEvent.ASSET_COMPLETE, onLoadAsset);
private function onLoadAsset(e:AssetEvent):void
{
if (e.asset.assetType == AssetType.CONTAINER)
{
loader3dContainer = e.asset as ObjectContainer3D;
view3d.scene.addChild(loader3dContainer);
}
loader.removeEventListener(AssetEvent.ASSET_COMPLETE, onLoadAsset);
loader.removeEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
}
I exported a awd model, all items in a container, one mesh and two lights.
the code to dispose
for (var i:int = 0; i < loader3dContainer.numChildren; i++)
{ var object:ObjectC
if (object is Mesh)
{
var material:TextureMultiPassMaterial = TextureMultiPassMaterial(Mesh(object).material);
BitmapTexture(material.texture).bitmapData.dispose();
material.texture.dispose();
material.dispose();
material = null;
}
}
loader3dContainer.disposeWithChildren();
loader3dContainer.dispose();
loader = null;
The memory always ground up. Please help.