A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Simple Trouble... maybe

  1. #1
    Senior Member
    Join Date
    Feb 2002
    I'm kinda stumped here. Why is this parser reading more than there needs to be. Please try this out and tell me what is wrong with my code. Basically what I want to do is duplicate a movie for every tag "menu_header" is read. But for some reason the duplicate movie is duplicating more than there needs to be. Please help me, thank you in advance.

    company = new XML();
    company.onLoad = readXML;
    company.load ("company.xml");

    function readXML () {

    mainTag = new XML;
    elementTag = new XML;
    articleList = new Array;
    elementList = new Array;

    mainTag = this.firstChild.nextSibling;
    if (mainTag.nodeName.toLowerCase() == "companybuttons") {
    articleList = mainTag.childNodes;
    //trace (articleList);
    for (i = 0; i <= articleList.length; i++) {
    //trace (i);
    if (articleList [i].nodeName.toLowerCase () == "button") {
    trace (i);
    elementList = articleList [i].childNodes;
    trace (elementList);
    for (j = 0; j <= elementList.length; j++) {
    elementTag = elementList [j];
    //trace (elementTag);
    elementType = elementTag.nodeName.toLowerCase();
    //trace (elementType);
    if (elementType == "menu_header") {
    menu_header = elementTag.firstChild.nodeValue;
    //trace (j);
    //trace (menu_header)
    duplicateMovieClip ("dynamic_button", "dynamic_button"+j, j);
    eval("dynamic_button"+j).menu_header = menu_header;
    eval("dynamic_button"+j)._y += 50 * j;

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Provo, Utah


    Without even looking at your code yet - my guess is that you have whitespace in your XML document, and you're not accounting for that in your code.

    If that is the case, it's easy to take care of.

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