Looped button displays only last when onPress

Hey

I already read this article stating that we need to make a variable out of i in order to choose the i of that moment during the loop…
http://www.senocular.com/flash/tutorials/faq/#loopfunctions

I made an Actionscript together with PHP script which looks for files in a certain folder:

here is the php script:


     <?php

$dir = "AanbodPDF";
$dh  = opendir($dir);
while (($filename = readdir($dh)) == true) {
    $files[] = $filename;
}

echo "&count=" . count($files);
for($i=0; $i<count($files); $i++) {
    echo "&echo" . $i. "=" . $files[$i];
}
 

and here is the AS of flash


var lv:LoadVars=new LoadVars();
var root:MovieClip=this;
var box:MovieClip

lv.onLoad = function(){
    for (var i:Number=0; i<this.count; i++){
        box = _root.attachMovie("box", "box"+i+"_mc", _root.getNextHighestDepth(), {_x:20, _y:30*i});
        box.num = i;
        box._txt.text = this["echo"+box.num];
        box.onPress = function (){
            trace ("/AanbodPDF/"+ this["echo"+this.num]);
            getURL("/AanbodPDF/"+ this["echo"+this.num], "_blank");
        }
    }
};
lv.sendAndLoad("readDir.php",lv);

Can you help me out? here is the link to the site
www.equicoach.be/aanbod.swf