This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash General > May 2004 > Flash 5 XML text question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Flash 5 XML text question
LowellHenderson.com

2004-05-20, 9:28 am

Hello,

I have a movie with XML text links. On the same level I load a movie with
animation and sound. I need to have the sound stop playing when the XML link
is clicked. I have managed to do it for a button on the frame, but I cannot
figure out how to do it with the XML links. Can anyone help me here?

This is the action I am using for the button:

on (release) {
gotoAndPlay (2);
MainStageMovie.mySound.stop();
MainStageMovie.playing = false;
}

Here is the link to what I am working on:
http://www.lowellhenderson.com/flash/index.html

And here is a copy of my XML convert script

eventXML = new XML();
eventXML.onLoad = converteventXML;
var event_feed_display
var eventdesc_feed_detail
event_feed_display = "Loading data...";
eventXML.load("http://www.lowellhenderson.com/XML/EventsXML.asp");
function converteventXML () {
if (eventXML.loaded) {
event_feed_display = "Data loaded.";
}
maineventTag = new XML();
elementeventTag = new XML();
eventList = new Array();
eventelementList = 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.
maineventTag = 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 (maineventTag.nodeName.toLowerCase() == "events") {
// if we have a match, we collect all of the articles beneath it as
an array of XML objects
eventList = maineventTag.childNodes;
// now we loop over all the articles and look for the tags we are
looking for...
event_feed_display = "";
for (i=0; i<=eventList.length; i++) {
// initialize a couple of variables to hold XML data we want
displayed
eventname_display = "";
eventdate_display = "";
if (eventList[i].nodeName.toLowerCase() == "event") {
// we get the child node array beneath the articles, aka the
meat and potatoes we are after
eventelementList = eventList[i].childNodes;
// and loop through that looking for the data we need
for (j=0; j<=eventelementList.length; j++) {
eventelementTag = eventelementList[j];
eventelementType =
eventelementTag.nodeName.toLowerCase();
if (eventelementType == "eventname") {
eventname_display =
eventelementTag.firstChild.nodeValue;
} else {
if (eventelementType == "eventlink") {
eventlink_display =
eventelementTag.firstChild.nodeValue;
}
if (eventelementType == "eventdescription") {
eventdescription_display =
eventelementTag.firstChild.nodeValue;
}
if (eventelementType == "eventdate") {
eventdate_display =
eventelementTag.firstChild.nodeValue;
}
}
}
event_feed_display += "<p><font face=\"helvetica\"
size=\"16px\"><u><a href=\""+eventlink_display+"\"
target=\"_new\">"+eventname_display+"</a></u></font></p>";

eventdesc_feed_detail += "<font face=\"Verdana\"
size=\"24px\" color=\"#FF3300\">"+eventname_display+"<BR></FONT><font
face=\"helvetica\" size=\"16px\"
color=\"#FF3300\">"+eventdate_display+"</font><BR><BR><font
face=\"helvetica\" size=\"14px\"
color=\"#FFFFFF\">"+eventdescription_display+"</font><BR><BR>";
}
}
}
}



Thanks!

Lowell

Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews