Let me start out by saying, I am TRYING to teach myself all about Flash and XML, but now I am running into some road blocks.
I am going to be working with a auto-generated XML from another program. The blocks that I am running into is trying to display an image, lets say a blue bubble, when the word Buzz is XML or a red bubble when Event is seen in a new field. See the example of one entry from the XML.
Next I am trying to show the timestamp in a new field. And for some reason I am having trouble with getting the URL to show.
I am using code from another XML/Flash piece that I did, with help, that I would hope to edit to make this work.
Thank you for the help. I am using Flash 8 pro & AS2.
XML:
Code:<?xml version="1.0" encoding="utf-8" ?> - <ContentEntries> - <ContentEntry id="171" type="Buzz" commentsEnabled="true" timestamp="4/6/2009 9:33:08 PM"> <Headline>Title</Headline> <Kicker>Kicker/Grab/Subheadline Text</Kicker> <Author id="0" name="Author Name" title="Author Title" /> <EntryImages authorImageSrc="URL" entryIconSrc="URL" /> <EventDetails /> <MainContent>Duis mi. Etiam vulputate hendrerit felis. In fermentum, risus id vestibulum posuere, enim purus tempor magna, eget laoreet dui risus vel orci. Curabitur at sapien sit amet lacus tincidunt venenatis. Quisque blandit. Mauris consectetur laoreet mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent sollicitudin augue quis nisl. Nunc faucibus lectus bibendum quam. Pellentesque suscipit, nisi sit amet facilisis mattis, elit diam sodales augue, at vulputate lorem turpis non urna.</MainContent> <EventImages /> <AssociatedMedia type="image" src="URL" previewSrc="URL" /> - <Comments count="1" title="What do you think about this?"> <Comment id="0" timestamp="128831890068281250" userName="Drewy5" iconSrc="URL">This is like the coolest thing ever.</Comment> <ImportanceModifier>8</ImportanceModifier> </ContentEntry> </ContentEntries>Code:function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; url = []; total = xmlNode.childNodes.length; for (i = 0; i < total; i++) { caption[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; url[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; } first_item(); } else { content = "file not loaded!"; } } xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("BuzzNews.xml?blarg=" + new Date().getTime()); // function first_item() { delay = 6500; p = 0; display(p); p++; } function timer() { myInterval = setInterval(ticker, delay); function ticker() { clearInterval(myInterval); if (p == total) { p = 0; } fadeout(); } } function display(pos) { newsMC.newsText._alpha = 100; newsMC.newsText.text = caption[pos]; newsMC.newsText.setTextFormat(out); newsMC.newsURL = url[pos] newsMC.enabled = false; if (newsMC.newsURL != undefined) { newsMC.enabled = true; } timer(); } over = new TextFormat(); over.underline = true; // nextbutton.onRelease = function() { clearInterval(myInterval); display(p); p++; if(p==total){ p=0; } delete this.onEnterFrame; }; out = new TextFormat(); out.underline = false; newsMC.onRelease = function() { getURL(this.newsURL, "_blank"); }; newsMC.onRollOver = function() { this.newsText.setTextFormat(over); }; newsMC.onRollOut = function() { this.newsText.setTextFormat(out); }; function fadeout() { this.onEnterFrame = function() { if (newsMC.newsText._alpha >= 0) { newsMC.newsText._alpha -= 5; } else { display(p); p++; delete this.onEnterFrame; } }; }




Reply With Quote
