A Script is making flash player slow

Hello,

I am working on a flash based application which calls a XML on server to load some values. XML size is not large (only 700 bytes) but some time my server take little longer time to respond and in that case flash player shows an error saying “A script in this movie is causing Flash Player to run slowly”.

When I searched over the internet for the cause and solution for this problem, I found a link from adobe http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15512&sliceId=1 which says

One way to break up a code block into smaller pieces of code is to spread the function or loop across multiple frames to 'distribute' the processing. 

The code may not run as quickly as a pure block of code on a fast machine, but if heavy manipulation is required, 
you can make your application more accessible to slow machines by considering different methods.

But since my application require user to be on one frame (its like a game) so I can’t break function or loop to run over multiple frames. Also, my AS code just read the XML and create an array and push values to array in a single loop. Now what I suspect that some time my XML is returned in partially and that might cause the problem. But currently I need to handle this in flash it self. Also, if some one is on slow connection this problem appear frequently.

So is there any way I can avoid the message. Below is my xml.onLoad code :


var myxmldata:Array = new Array();
var myxml:XML = new XML();
myxml.ignoreWhite = true;
myxml.onLoad = function(sucess:Boolean) {
     if (success) {
       for(var i=0;i<this.firstChild.childNodes.length;i++) {
          myxmldata* = this.firstChild.childNodes*.firstChild.nodeValue;
     }else {
        trace('failed to load xml');
    }
}
myxml.load('http://www.myserver.com/xmlfiles/getlist.xml');

Thanks.

:worried: