A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 - Loop crashing flash player

  1. #1
    Member
    Join Date
    Sep 2001
    Posts
    72

    AS2 - Loop crashing flash player

    I'm loading an XML that has grown quite large and putting the contents into one textbox. There were no issues when the XML was small but after it grew in size I noticed it started hanging FLASH and occasionally crashing it all together.

    I have one loop inside another to structure the contents in the textbox the way I need it. It's the second loop that is causing the crash. Does anyone have a better suggestion for doing this?

    Code:
    for (i=0; i<total; i++) {
    	headline[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    	date[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
    	copy_intro[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;			
    	image_large[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
    	copy_full[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;			
    	txt_mc.txt.htmlText = adddate;
    for(a=0; a<total; a++){
    	txt_mc.txt.htmlText += headline[a] +"\n"+date[a]+"\n"+copy_full[a];
            }
    }
    Thanks for taking a moment to look at this, I'm not a natural coder so any and all help is greatly appreciated.

    Best,
    Kumba

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    It looks like you are assigning the txt_mc.txt.htmlText at the end of your first loop. Why can you add the headline, date and copy at the same time? It looks like they should be populated with the appropriate information. I don't see a need for the 2nd loop inside the first one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center