Results 1 to 2 of 2

Thread: Flash/PHP/XML

  1. #1
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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???

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Try removing the XML deceleration and header.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •