Groups | Blog | Home
all groups > flash data integration > june 2005 >

flash data integration : Flash and XML; using a lot of memory


Ken
6/3/2005 3:53:00 AM
Hi all,

I'm filling a datagrid with entries from an XML file using the following
code. Although the code uses a lot of CPU and sometimes it causes Flash
player to prompt for aborting the script (I reply no and it works fine
after that), my problem is memory usage.

Although my XML file is at most 5MB, Flash player (7) uses up to 150MB
of RAM. Plus, closing the player doesn't immediately release memory, but
it rather appears in Task Manager for quite a while, slowly decreasing
memory usage.

I'd like to ask if that's a problem of Flash handling big XML files, or
if it's a problem with my code (creating recursive loops or anything
like that).

Can anyone check the following code and possible provide an alternative
way for the same task?

Thanks a lot in advance

=====================================================================
lib_xml = new XML();
lib_xml.ignoreWhite = true;
lib_xml.onLoad = function(success){
if(success){
list_root = library_xml.firstChild.firstChild.childNodes[11];
num_list_nodes = list_root.childNodes.length;
num_t = 0;
for(i=0; i<num_list_nodes; i++){
if (list_root.childNodes[i].nodeName == "dict"){
num_t ++;
t1=list_root.childNodes[i].childNodes[3].firstChild.nodeValue;
t2=list_root.childNodes[i].childNodes[5].firstChild.nodeValue;
playlist_grid.addItem({COL1:t1,COL2:t2});
}
}
total_t.text = num_t;
} else {
trace("Error loading XML");
}
}
perry
6/3/2005 7:47:34 AM
your code seems ok to me, but 5 MB of xml is simply too much for flash
player.
i split files up to a maximum of about 60kB. that´s a data load th player
can handle easily.

"Ken" <ken@b-online.gr> schrieb im Newsbeitrag
news:d7o9ld$d8m$1@forums.macromedia.com...
[quoted text, click to view]

Ken
6/3/2005 8:57:28 AM
somaboy mx
6/4/2005 9:42:50 AM
[quoted text, click to view]

if you create the datagrid with attachMovie or duplicateMovieClip you
can remove it with removeMovieClip();

to free the xml object, you could load some empty xml data into it, for
example a tree containing just one node.

AddThis Social Bookmark Button