Log in

View Full Version : php generated xml vs hand typed



rd42
10-31-2008, 02:01 PM
php generated xml does not display images in flash, but the hand typed does, any ideas?

Could this be caused by the filename being .php instead of .xml? I can't see any difference in the XML from the PHP vs the hand typed XML.

I'm using ActionScript 3.0, Flash CS3.



PHP generated XML (view source from php file data3.php) - doesn't work

<?xml version="1.0"?>
<slideshow>

<photo url="http://xxxx/images/CelliOliveOilBlend.png" caption="1 Liter Bottle"/>

<photo url="http://xxxx/lava/images/1224858460.jpg" caption="6 Pack Bottles"/>
</slideshow

Flash load function for php xml file

x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}

x.load("data/data3.php");


Hand typed XML - works - data3.xml

<?xml version="1.0"?>
<slideshow>

<photo url="http://xxxx/images/CelliOliveOilBlend.png" caption="1 Liter Bottle"/>

<photo url="http://xxxx/lava/images/1224858460.jpg" caption="6 Pack Bottles"/>
</slideshow

Flash load function for xml data3.xml

x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}

x.load("data/data3.xml");

Medyman
10-31-2008, 06:43 PM
Try removing the XML declaration from the PHP and see if it makes a difference.

rd42
10-31-2008, 10:15 PM
you da man, the Medyman!

Thanks! It worked.

Twey
10-31-2008, 11:17 PM
You should set an appropriate content-type:
header('Content-Type: application/xml');