Upgrading this code to AS2?

hello all, im playing with the load random movie (but loading a random xml file instead) based on the wonderful tutorial from front page and was wondering whether anyone can show me the work around/upgrade to AS2 for this bit of script since im publishing to Flash 8 /AS2 and it doesnt work:


filename = ["gallery.xml", "gallery01.xml", "gallery02.xml", "gallery03.xml", "gallery04.xml"];
path = "http://www..co.uk/";
i = filename.length;
k = Math.floor(Math.random()*i);
xml.load(path+filename[k]);

yet if i drop the ranodm code up there and simply put this code per each xml file they load individually ok

xml.load("gallery01.xml");

all i want to achieve is to load any random one of ‘X’ amount of images via an XML sheet, so ive spread each ordered list across 5 different linear (top down) XML files - each one loaded randomly, giving the impression that the flash file loads a random image each time.

i know its a long work around but where am i going wrong?

thank you