jasonrhl
01-15-2008, 03:03 AM
We cant get an image to show on our flash app.
We have a streaming radio station that creates and xml file which we grab album name , track and artist info from the id3 tag.
We are trying to show the album art.
We are hoping someone can tell us what we are doing wrong.
the example we are trying to get the album bum to bring up an image cali.jpg when it is in the xml file. We just get a blank space where the art should be (no errors)
// The first step is to activate the XML object
headlineXML = new XML();
xml.onLoad = function() {
//the methods to handle the xml
}
headlineXML.onLoad = myLoad;
headlineXML.load("/headlines.xml");
var intervalID = setInterval(this, "loadXML",1*10*1000);
/*
With the XML Object now active you must now load an XML foramtted document.
Any DTD or XLS formatting will be ignored.
*/
function loadXML() {
headlineXML.onLoad = myLoad;
headlineXML.load("headlines.xml");
}
// Before proceeding to far into the program, make sure the XML document has loaded
// Extract information from the XML file
function myLoad(ok) {
if (ok == true) {
Publish(this.firstChild);
}
}
function Publish(HeadlineXMLNode) {
if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
content = "";
story = HeadlineXMLNode.firstChild;
while (story != null) {
if (story.nodeName.toUpperCase() == "STORY") {
LEAD = "";
TRACK = "";
URL = "";
ALBUM = "";
URL2 = "";
element = story.firstChild;
while (element != null) {
if (element.nodeName.toUpperCase() == "LEAD") {
lead = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "TRACK") {
TRACK = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL") {
url = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "ALBUM") {
album = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL2") {
url2 = element.firstChild.nodeValue;
}
element = element.nextSibling;
}
albumString = "";
if(album == "bum"){
albumString = "<img src='cali.jpg'>";
}
else if(album == "album name 2"){
}
else if(album == "album name 3"){
} //and so on
else{
albumString = "<font size='-2'>Album:</font><font color='#336666'> <a href='"+URL2+"'><"+ALBUM+"></a></font>";
}
content += "<body><font size='+2'><b>"+LEAD+"</b></font><br>"+albumString+"<br><font size='-2'>Track: </font><font color='#ff0000'><a href='"+URL+"'>"+track+"</a></font></body>";
txt.htmltext=content;
}
story = story.nextSibling;
}
}
}
we are beginners with flash and have been using a code we found about displaying xml headlines.
Sorry if we have this in the wrong area.
We have a streaming radio station that creates and xml file which we grab album name , track and artist info from the id3 tag.
We are trying to show the album art.
We are hoping someone can tell us what we are doing wrong.
the example we are trying to get the album bum to bring up an image cali.jpg when it is in the xml file. We just get a blank space where the art should be (no errors)
// The first step is to activate the XML object
headlineXML = new XML();
xml.onLoad = function() {
//the methods to handle the xml
}
headlineXML.onLoad = myLoad;
headlineXML.load("/headlines.xml");
var intervalID = setInterval(this, "loadXML",1*10*1000);
/*
With the XML Object now active you must now load an XML foramtted document.
Any DTD or XLS formatting will be ignored.
*/
function loadXML() {
headlineXML.onLoad = myLoad;
headlineXML.load("headlines.xml");
}
// Before proceeding to far into the program, make sure the XML document has loaded
// Extract information from the XML file
function myLoad(ok) {
if (ok == true) {
Publish(this.firstChild);
}
}
function Publish(HeadlineXMLNode) {
if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
content = "";
story = HeadlineXMLNode.firstChild;
while (story != null) {
if (story.nodeName.toUpperCase() == "STORY") {
LEAD = "";
TRACK = "";
URL = "";
ALBUM = "";
URL2 = "";
element = story.firstChild;
while (element != null) {
if (element.nodeName.toUpperCase() == "LEAD") {
lead = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "TRACK") {
TRACK = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL") {
url = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "ALBUM") {
album = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL2") {
url2 = element.firstChild.nodeValue;
}
element = element.nextSibling;
}
albumString = "";
if(album == "bum"){
albumString = "<img src='cali.jpg'>";
}
else if(album == "album name 2"){
}
else if(album == "album name 3"){
} //and so on
else{
albumString = "<font size='-2'>Album:</font><font color='#336666'> <a href='"+URL2+"'><"+ALBUM+"></a></font>";
}
content += "<body><font size='+2'><b>"+LEAD+"</b></font><br>"+albumString+"<br><font size='-2'>Track: </font><font color='#ff0000'><a href='"+URL+"'>"+track+"</a></font></body>";
txt.htmltext=content;
}
story = story.nextSibling;
}
}
}
we are beginners with flash and have been using a code we found about displaying xml headlines.
Sorry if we have this in the wrong area.