PDA

Click to See Complete Forum and Search --> : XML MC within a MC



atracksler
04-26-2001, 03:21 PM
I would be eternally grateful if someone even has a clue on this problem.

I have been working with the XML and Flash 5 Tutorial on Flashkit and have a Movie clip with a textbox that points to the XML document and a layer with actions (just stop) and a labels layer.

This MC works like a charm when I go to test the scene.

When I place this in my main MC, it stalls on the loading data section.

THe code is below:

urlXML = new XML();
urlXML.theMC = this;
urlXML.onLoad = convertXML;


content_feed_display = "Loading data...";
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;

//first get a handle on the first actual element in the document.
//note we skip to the nextSibling element, since the first element
//is a document definition tag.
mainTag = this.firstChild.nextSibling;
//make sure we have the right parent tag. Do this by looking at the nodeName property
//for this object. This will correspond exactly to the <nodeName>, where nodeName is replaced
//with the name of your xml tag
if(mainTag.nodeName.toLowerCase() == "moreovernews") {
//if we have a match, we collect all of the articles beneath it as an array of xml objects
articleList = mainTag.childNodes;
//now we loop over all the articles and look for the tags we are looking for...
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.nodeName.toLowerCase() == "article") {
//we get the child node array beneath the articles, aka the meat and potatoes we are after
elementList = articleList.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>";
}
}


}



}



Is there a way to get this to work? It is the answer to all my prayers! I know that it must be something in the way that the "this." part of the script.

Thank you in advance for your help.

dbonneville
04-26-2001, 06:07 PM
Where is the xml tutorial? I can't find it. All I see is 4 tutorials relating to "dymanic content", but nothing about xml per se. Where do I need to look?

Thanks!

fancyk
04-26-2001, 11:07 PM
Originally posted by dbonneville
Where is the xml tutorial? I can't find it. All I see is 4 tutorials relating to "dymanic content", but nothing about xml per se. Where do I need to look?

Thanks!

Here it is:
http://www.flashkit.com/tutorials/3rd_Party/Flash_5_-Chris_Sm-213/index.shtml

-k

treyratcliff
04-30-2001, 12:11 AM
Yes I did that tutorial -- it works just fine... I think you may have to change what is inside the LOAD string.