Need help w/PHP: string files, flash arrays

Edit: I basically rewrote whole post after finding out more information on Flash and PHP and testing new code.
Edit 2: Replaced code tags with AS tags to display AS correctly.

I’m using Scottyls V3_nextprev.fla (basically the “V3 scrolling thumbnails” with next/prev buttons added) as a base for my image gallery. Instead of using XML to load the images and thumbs, I want to use PHP to spit the images and thumbs out and assign them to two arrays (the pArray and tArray).

Here’s my PHP code

<?php
$tDir = opendir('thumbs'); 
while ($tFile = readdir($tDir)) { 
if ($tFile=="." or $tFile=="..") continue; 
$tString.= "thumbs/".$tFile; 
$tString.= ","; 
} 

echo "&tList=".$tString;

$pDir = opendir('images'); 
while ($pFile = readdir($pDir)) { 
if ($pFile=="." or $pFile=="..") continue; 
$pString.= "images/".$pFile; 
$pString.= ","; 
} 

echo "&pList=".$pString;
?>

Which outputs the data as

&tList=thumbs/timage1.jpg,thumbs/timage2.jpg,&pList=images/image1.jpg,images/image2.jpg,

and so on.

From what I can tell, all the arrays and gallery information are originated at this actionscript
[AS]function galleryChoice(q) {
pArray = new Array();
tArray = new Array();
my_xml = new XML();
for (var j = 0; j<curLength; j++) {
this.scroll.th_nav[“thmb”+j].removeMovieClip();
}
my_xml.ignoreWhite = true;
my_xml.onLoad = function(loaded) {
if (loaded) {
gallery = this.firstChild.childNodes[q];
curLength = gallery.childNodes.length;
for (var i = 0; i<gallery.childNodes.length; i++) {
pArray.push(gallery.childNodes*.attributes.source);
tArray.push(gallery.childNodes*.attributes.thumb);
}
}
delay = setInterval(makeButtons, 50);
};
my_xml.load(“gallery.xml”);
}
[/AS]
and so I have been trying to modify it since I don’t want to use the XML file.

Here is what I’ve come up with:
[AS]function galleryChoice(q) {
pArray = new Array();
tArray = new Array();
//reset variable cur
cur = 0;
for (var j = 0; j<curLength; j++) {
this.scroll.th_nav[“thmb”+j].removeMovieClip();
}
lv = new LoadVars();
lv.onLoad = function(loaded) {
if (loaded) {
pArray = this.pList.split(",");
tArray = this.tList.split(",");
curLength = lv.tList.split(",").length -1;
for (var i = 0; i<lv.tList.split(",").length; i++) {
pArray.push = this.pList.split(",");
tArray.push = this.tList.split(",");
}
}
delay = setInterval(makeButtons, 50);
};
lv.load(“getfiles.php”);
}
[/AS]
But this only loads the thumbnails in the final swf. It doesn’t load the first main image like it should, and it doesn’t make the thumbnails clickable to load the main images. There are no errors produced in the actionscript when debugging in flash, so I’m not sure what’s going on.

If anyone can give me some pointers I’d appreciate it.