?
Solved

Flash as 3.0 Loader Memory extending

Posted on 2009-03-31
7
Medium Priority
?
301 Views
Last Modified: 2013-11-11
Hi, I have a main file with a loader+ 2 buttons in it which loads & unloads 2 external ".swf" files and a trace to monitor the System.totalMemory. PROBLEM IS after  my unload command the memory dosnot get's free and even increasing on every load then unload command.

var loaderObj:Loader
var sp:Sprite= new Sprite()
 
function mcLoad(e:MouseEvent){	
	loaderObj= new Loader();
	loaderObj.name='tension';
 	var str:String="i.jpeg";
	loaderObj.load(new URLRequest(str));
	sp.addChild(loaderObj);
	stage.addChild(sp)
}
 
function mcUnload(e:MouseEvent){
	loaderObj.unload();
	sp.removeChild(loaderObj);
	stage.removeChild(sp)
	trace(System.totalMemory);
}
 
b0.addEventListener(MouseEvent.CLICK,mcLoad);
b1.addEventListener(MouseEvent.CLICK,mcUnload);

Open in new window

0
Comment
Question by:aditkohli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 9

Accepted Solution

by:
asaivan earned 672 total points
ID: 24061591
try setting sp to null, after you've removed it from the stage.

e.g.

sp = null;
0
 

Expert Comment

by:bridgetimiller
ID: 24064124
Try using Loader.unloadAndStop().  This is allow help clear all references to the Loader and make it accessible for garbage collection.
0
 

Assisted Solution

by:bridgetimiller
bridgetimiller earned 664 total points
ID: 24064133
loaderOjb.unloadAndStop() in your case. :)
0
 
LVL 39

Assisted Solution

by:blue-genie
blue-genie earned 664 total points
ID: 24084283
flash players garbage collection is not as robust as Java or .NET - you can't force it to happen.
by removing item and deleting references you free them up to be garbage collected but it may not happen immediately.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question