Loader3D memory deallocation

Software: Away3D 4.x

Denis, Newbie
Posted: 17 January 2013 11:15 AM   Total Posts: 15

Hi, I need help. Loader3D does not want to free memory.
Sample code:

//my mesh resource
[Embed(source="../../resources/angar/angar1.3DS"mimeType="application/octet-stream")private const AngarM:Class;

.
.
.
.

//init loader
var angarRes:* = new AngarM();
 
loader = new Loader3D();
 
loader.loadData(new AngarM());
 
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETEonLoadResource);
 
angarRes null;

.
.
.
.
.


//clean memory

loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETEonLoadResource);
for (var 
int 0loader.numChildren; ++i)
{
    loader
.getChildAt(i).dispose();

loader
.disposeAsset();
loader.dispose();
loader=null

What am i doing not right?

   

Jackal, Newbie
Posted: 18 January 2013 08:18 AM   Total Posts: 10   [ # 1 ]

in addition to dispose or after disposing try this :

private function clean_loader():void
   {
    
var mesh:Mesh;
    var 
len:uint loader.numChildren;
    
    for (var 
uint 0len; ++i)
    
{
     mesh 
Mesh(loader.removeChild(loader.getChildAt(i)));

     
    
}
 
    
   } 
   

Denis, Newbie
Posted: 18 January 2013 08:27 AM   Total Posts: 15   [ # 2 ]

I solved the problem changing new Loader3D () on the new Loader3D (false). Resources previously added to the Asset Library. False flag does not add resources to the library, thus release objects.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X