Dynamically loading images?

Hi, I am trying to dynamically load a set of images into flash.

I have the current file made in PHP and HTML which I am converting to flash.
http://gazler.com/bd/gallery.php

I have then printed the values from one of the photos in this page.
http://www.gazler.com/bd/galleryflash.php

I can display the image width, height, filename, etc. fine, but when it comes to loading the image, I get an error.


Error opening URL "[http://gazler.com/bd/photos/thumbs/undefined](http://gazler.com/bd/photos/thumbs/undefined)"


stop();
  loadVariables("[http://gazler.com/bd/galleryflash.php](http://gazler.com/bd/galleryflash.php)", textStatus, "GET");
this.pathToPics = "[http://gazler.com/bd/photos/thumbs/](http://gazler.com/bd/photos/thumbs/)";
this.pArray = [textThumb];
this.fadeSpeed = 20;
this.pIndex = 0;
loadMovie(this.pathToPics+this.pArray[0], _root.photo)
MovieClip.prototype.changePhoto = function(d) {
 
 this.pIndex = (this.pIndex+d)%this.pArray.length;
 if (this.pIndex<0) {
  this.pIndex += this.pArray.length;
 }
 this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
 if (this.photo._alpha>this.fadeSpeed) {
  this.photo._alpha -= this.fadeSpeed;
 } else {
  this.loadPhoto();
 }
};
MovieClip.prototype.loadPhoto = function() {
 var p = _root.photo;
 p._alpha = 0;
 p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
 this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
 var i, l, t;
 l = this.photo.getBytesLoaded();
 t = this.photo.getBytesTotal();
 if (t>0 && t == l) {
  this.onEnterFrame = fadeIn;
 } else {
  trace(l/t);
 }
};
MovieClip.prototype.fadeIn = function() {
 if (this.photo._alpha<100-this.fadeSpeed) {
  this.photo._alpha += this.fadeSpeed;
 } else {
  this.photo._alpha = 100;
  this.onEnterFrame = null;
 }
};
this.onKeyDown = function() {
 if (Key.getCode() == Key.LEFT) {
  this.changePhoto(-1);
 } else if (Key.getCode() == Key.RIGHT) {
  this.changePhoto(1);
 }
};
Key.addListener(this);

The code is from the photo gallery in the tutorials.

Any help is appreciated. Cheers, Gaz.