How I can dispose correctly?. Please help

Software: Away3D 4.x

AlexisCuba, Newbie
Posted: 02 February 2014 04:11 PM   Total Posts: 2

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_COMPLETEonLoadAsset);

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_COMPLETEonLoadAsset);
   
loader.removeEventListener(LoaderEvent.LOAD_ERRORonLoadError);

  I exported a awd model, all items in a container, one mesh and two lights.

the code to dispose

for (var i:int 0loader3dContainer.numChildreni++) 
    
{      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.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X