Problem with gallery. Images are not showing

Hello,
I’m making a gallery. What gallery would it be without image scaling, right? So I found this code (Which is between //// signs). As you may already understood, I’m a beginner to flash. Now the problem: The image loads at first launch, but when I press buttons next and previous, it doesn’t change. Apparently if I put the image path into a variable, the image doesn’t display at all. Still, when tracking the path variable, and copying it directly to loadClip function, it displays correctly. I’m using Flash 8.

Here’s the code:

/////////////////////////////// v-PIC SCALE-v ///////////////////////////////////
// Container dimensions
var containerWidth:Number = 640;
var containerHeight:Number = 480;

// Create container movieclip
var container_ref:MovieClip = this.createEmptyMovieClip("container_clip", this.getNextHighestDepth());

// Draw a border for container
with(container_ref)
{
    lineStyle(2, 0x000000, 100);
    lineTo(containerWidth, 0);
    lineTo(containerWidth, containerHeight);
    lineTo(0, containerHeight);
    lineTo(0, 0);
    _x = (Stage.width / 2) - (container_ref._width / 2);
    _y = 50;
}

// Create container movieclip
var image_ref:MovieClip = container_ref.createEmptyMovieClip("image_clip", container_ref.getNextHighestDepth());

// Create listener object
var loadListener:Object = new Object();

// Create loader
var image_Loader:MovieClipLoader = new MovieClipLoader();

// Add a listener to the loader
image_Loader.addListener(loadListener);

// This is initated when the picture is loaded
loadListener.onLoadInit = function(mc:MovieClip)
{      
    var wDiff:Number = 0;
    var hDiff:Number = 0;
    if (mc._width > mc._parent._parent.containerWidth)
    {
        var wDiff:Number = mc._width - mc._parent._parent.containerWidth;
    }
    if (mc._height > mc._parent._parent.containerHeight)
    {
        var hDiff:Number = mc._height - mc._parent._parent.containerHeight;
    }
    if (wDiff > 0 and wDiff <= hDiff)
    {
        var multiplier:Number = mc._parent._parent.containerWidth / mc._width;
        Math.floor(mc._width *= multiplier);
        Math.floor(mc._height *= multiplier);
    }
    else if (hDiff > 0 and hDiff < wDiff)
    {
        var multiplier:Number = mc._parent._parent.containerHeight / mc._height;
        Math.floor(mc._width *= multiplier);
        Math.floor(mc._height *= multiplier);
    }
    var xOffset:Number = mc._parent._parent.containerWidth - mc._width;
    var yOffset:Number = mc._parent._parent.containerHeight - mc._height;
    if (xOffset > 0)
    {
        mc._x += (xOffset / 2);
    }
    if (yOffset > 0)
    {
        mc._y += (yOffset / 2);
    }

    // Debug traces
    trace("Instance Name: " + mc._name);
    trace("Original image_clip._width: " + mc._width);
    trace("Original image_clip._height: " + mc._height + newline);
    trace("container_clip._width: " + _root.containerWidth);
    trace("container_clip._height: " + _root.containerHeight + newline);
    trace("wDiff: " + wDiff);
    trace("hDiff: " + hDiff);
    trace("xOffset: " + xOffset);
    trace("yOffset: " + yOffset);
}
///////////////////////////////// ^-PIC SCALE-^ ///////////////////////////////////

function muudaPilti(newSlideNode) {
    path = newSlideNode.firstChild.nextSibling.firstChild;
    pildinimi.text = newSlideNode.firstChild.nextSibling.nextSibling.firstChild;
    kaunter.text = (currentPic+1) + '/' + (piltideArv);
    
    // Load picture. 
    // This only works if I specify the path. 
    image_Loader.loadClip("albumid/Lambikad/IM000811.JPG", image_ref);
    
    // This doesn't work
    //image_Loader.loadClip(path, image_ref);
    
    // This returns the correct picture path
    trace(path);
}

myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success){
    if(success){
        // proccess
        currentPic = 0;
        allGalleryData = this.firstChild.childNodes;
        for(i = 0; i < allGalleryData.length; i ++){
            piltideArv = i+1;
        }
        // Load the first picture
        muudaPilti(allGalleryData[0]);
    } else {
        trace('Fail puudub');
    }
    
}
but_j2rgmine.onRelease = function() {
    if(currentPic < (piltideArv-1)){
        currentPic ++;
        muudaPilti(allGalleryData[currentPic]);
    }
}
but_eelmine.onRelease = function() {
    if(currentPic > 0){
        currentPic --;
        muudaPilti(allGalleryData[currentPic]);
    }
}
myXML.load('pictures.xml');

Code is partially in my first language, but it shouldn’t be a problem.

Now the output when I test it:

albumid/Lambikad/IM000810.JPG
Instance Name: image_clip
Original image_clip._width: 640
Original image_clip._height: 480

container_clip._width: 640
container_clip._height: 480

wDiff: 1408
hDiff: 1056
xOffset: 0
yOffset: 0

If you need an example to look at, you can find it here: http://iou.pri.ee/galerii/galerii.html

Tom.