A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Help with moreover tutorial

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    2
    Hey all,

    I'm pretty new with xml and the xmlobject.
    I've tried doing the tutorial from flashkit on incorporating moreover headlines into flash with xml but no headlines appear. I'm not running this off a server so I'm assuming it should work. It just seems to stop at data loaded. Can anyone tell me if there's a mistake in the code in the tutorial.

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    I haven't seem the tutorial - how about you post the code you're using??

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Posts
    2

    Here's the code

    The code below is an exact copy from the tutorial.
    I can't seemt to get it to work, it always stops at
    Data Loaded. Thanx for the help.

    Code:
    //create a new xml object
    urlXML = new XML();
    //when the xml data has loaded, we want the XML Object to run the convertXML function
    urlXML.onLoad = convertXML;
    //Write to your text area that the data is loading.
    content_feed_display = "Loading data...";
    //now load up the url.
    urlXML.load("moreover.xml");
    function convertXML() {
        if(this.loaded) {
            content_feed_display = "Data loaded.";
        }
        mainTag = new XML;
        elementTag = new XML;
        articleList = new Array;
        elementList = new Array;
        mainTag = this.firstChild.nextSibling;
        if(mainTag.nodeName.toLowerCase() == "moreovernews") {
            articleList = mainTag.childNodes;
            content_feed_display = "";
            for(i=0;i<=articleList.length;i++){
                //initialize a couple of variables to hold xml data we want displayed
                document_url = "";
                headline_text = "";
                if(articleList[i].nodeName.toLowerCase() == "article") {
                    //we get the child node array beneath the articles, aka the meat and potatoes we are after
                    elementList = articleList[i].childNodes;
                    //and loop through that looking for the data we need
                    for(j=0;j<=elementList.length;j++) {
                        elementTag = elementList[j];
                        elementType = elementTag.nodeName.toLowerCase();
                        if(elementType == "headline_text"){
                        headline_text = elementTag.firstChild.nodeValue;
                        } else {
                            if(elementType == "url"){
                                url = elementTag.firstChild.nodeValue;
                            }
                        }
                    }
                content_feed_display += "<p><font size=\"+2\"><a href=\"" + url + "\" target=\"_new\">"+ headline_text +"</a></font></p>";
                }
            }
        }
    }

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112

    Uhh...

    I was thinking more of the code that you actually used in your program (not the code in the tutorial) - maybe a misstype or something... I'll look at the code you provided and let you know if I see anything - although tupps usually sees things before I do

  5. #5
    Senior Member
    Join Date
    Feb 2002
    Posts
    306
    are you using the same XML file included in the Tutorial?

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