Flash list documents (doc, pdf, xls...) in a folder

I want to dynamically list documents by link (path
ame) that a user can click on and get redirect (or bring the document up in flash) using flash (CS3).

I already know (through hours of research) that I need an xml file created in php or asp to load from flash - e.g. xmlDocument.Load(“source.php”) - to list these files. I have tried every combination of php and flash code to acheive this but nothing works.

one example:

[COLOR=red]PHP: (file name source.php in same directory as fla/swf and forms - where the documents are - is subdirectory in that same directory)[/COLOR]

<?php
// Set which extensions should be approved in the XML file
$extensions = array
(
‘doc’, ‘DOC’,
‘pdf’, ‘PDF’,
‘xls’, ‘XLS’,
‘pub’, ‘PUB’
);
// Echo the header (XML)
header(“Content-Type: application/xml;charset=ISO-8859-1”);
// Prepare the XML file
echo ‘<?xml version=“1.0” encoding=“ISO-8859-1”?>’ . "
";

// Get the files from the current directory
if (file_exists ("/forms"))
{
if (is_dir ("/forms"))
{
$dh = opendir ("/forms") or die (" Directory Open failed !");

// Prepare the images array
$imgs = array();
while ($file = readdir ($dh))
{
// Only get the files ending with the correct extension
if ( in_array( substr($file, -3), $extensions ) )
{
array_push($imgs, $file);
}
}
Closedir ($dh);
}

// Sort the array
sort($imgs);

echo "<images>
";
foreach ($imgs as $img)
{
// Return all images in XML format
echo (’ <image>’ . $img . ‘</image>’);
echo "
";
}
}
echo “</images>”;
?>

[COLOR=red]FLASH:[/COLOR]
[FONT=Times New Roman][SIZE=3]this.createTextField(“my_txt”, this.getNextHighestDepth(), 28, 200, 320, 100);[/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]my_txt.autoSize = “left”;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]my_txt.border = true;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]my_txt.multiline = true;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]my_txt.wordWrap = true;[/FONT][/SIZE]

[SIZE=3][FONT=Times New Roman]var reviews_xml:XML = new XML();[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]reviews_xml.ignoreWhite = true;[/FONT][/SIZE]

[SIZE=3][FONT=Times New Roman]// When XML data is loaded, execute this function[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]reviews_xml.onLoad = function (success:Boolean):Void [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]if (success)[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]var childItems:Array = reviews_xml.firstChild.childNodes;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]for (var i:Number = 0; i < childItems.length; i++) [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]{ [COLOR=red]This line never executes as if childItems.length = 0[/COLOR][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] my_txt.text += childItems*.firstChild.firstChild.nodeValue + "
";[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]}else[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]my_txt.text = “Unable to load external file.”;[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]reviews_xml.load(“source.php”);[/FONT][/SIZE]