[fmx04] loading images randomly and put them in _x and _y coordinates problem

hi,

I have a problem with loading images randomly and putting them in the right _x and _y coordinates.
I have a swf file with in the first frame a button with this code :

on (release) {
filename = [“image-01.jpg”, “image-02.jpg”, “image-03.jpg”];
path = “images/”;
i = filename.length;
k = Math.floor(Math.random()*i);
mctarget.loadMovie(path+filename[k]);
gotoAndPlay(“intropreloadit”);
}

in frame 10 I have this code for preloading the dynamically loaded image :

// set the movieclip invisible
mctarget._visible = false
// get the loaded and total bytes
total = mctarget.getBytesTotal();
loadedbytes = mctarget.getBytesLoaded();
percentage = Math.floor((loadedbytes/total)*100);
// when dynamically loading, make sure you set getbytesLoaded()>0
if (mctarget.getBytesLoaded()>0) {
// set the progressbar
mcprogressbar._xscale = percentage;
// set the percentage dynamic textfield
mcprogresstxt.perc = percentage+"%";
} else {
mcprogressbar._xscale = 0;
mcprogresstxt.perc = 0+"%";
mcprogresstxt.bytestotal = Math.floor(total/1000) + " KB";
mcprogresstxt.bytesloaded = Math.floor(loadedbytes/1000) + " KB /";
}

in frame 11 :

if (percentage == 100) {
gotoAndStop(“introdoneloading”);
} else {
gotoAndPlay(“intropreloadit”);
}

and in frame 12 :

// done loading image so now we can position the image.
// centerpoint of the movieclip “mctarget” to be set as you wish.
x = 640;
y = 230;
// now we get the size of the image
introwidth = mctarget._width;
introheight = mctarget._height;
// finally, set new _x and _y position to center the image to the centerpoint
mctarget._x = x-(introwidth/2);
mctarget._y = y-(introheight/2);
/* ready with loading of the .jpg file --> then set mctarget._visible = false of true */
mctarget._visible = true
stop();

the image gets loaded and placed correctly when played from the harddisk. the problem starts when i upload the swf to the internet, then the image won’t be centered but the left upper point of the image is placed at x=640 and y=230

what am I doing wrong?
max.

when I click on the button I tell the flashplayer to --> gotoAndPlay(“intropreloadit”);
now I changed this to --> gotoAndPlay(9);

frame 9 is 1 frame before framelabel “intropreloadit” apparently flash needs 1 frame to figure out what image needs to be loaded, I think. I could solve it by adding one more frame, but I have the feeling that there’s a better way of doing this.

can anyone help me out with this.