-
Flash/PHP/XML
Hi there,
I'm trying to build a photo viewer with flash.
Everything is working and i'm reading the files from an XML into flash.
Now i want to do this automated with a PHP file but it isn't working.
flash file
var x:XML = new XML();
x.ignoreWhite = true;
var urls:Array = new Array();
x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
urls.push(photos[i].attributes.url);
trace ("hallo");
//captions.push(photos[i].attributes.caption);
}
whoIsOn = 0;
//trace(urls[whoIsOn]);
my_mcl.addListener(mclListener);
my_mcl.loadClip(urls[whoIsOn],img_mc);
}
x.load("laden.php");
PHP file
<?php
header("Content-Type: text/xml");
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
//getting all files of desired extension from the dir using explode
$desired_extension = 'jpg'; //extension we're looking for
$dirname = "images/small/";
$dir = opendir($dirname);
while(false != ($file = readdir($dir)))
{
if(($file != ".") and ($file != ".."))
{
$fileChunks = explode(".", $file);
if($fileChunks[1] == $desired_extension) //interested in second chunk only
{
echo '<photo>' . $file . '</photo>';
}
}
}
closedir($dir);
?>
I'm not that good at scripting can anyone help me???
-
-
Try removing the XML deceleration and header.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks