Odd Flash behavior: Can`t rescale a loadMovie JPG but with button

Heya,

I am loading JPGs for a little gallery into my flashfile. Once I loaded them into the flashfile with a script in the 1st frame I want to do things with them like setting x and y postion, the alpha as well as rescaling the JPG with the _width and _heigth command. Everything works fine EXCEPT setting the height and width command. So I added a button with script No 2 (see below)

SCRIPT 1:

	_root.numberOfPictures = 7; // number of pics to be loaded
	startPosition = 20	// x postion for pics
		
	for (x=1; x<=numberOfPictures; x++) {
	
		picName = "pic0" + x +".jpg"; // name of file to be loaded
		instanceName = "mcThumbnail0" + x;
			
		duplicateMovieClip (_root.mcEmpty, instanceName, x);
		loadMovie(picName,instanceName);

		setProperty (instanceName, _x, startPosition);
		setProperty (instanceName, _y, 330);
		setProperty (instanceName, _alpha, 50);
		setProperty (instanceName, _height,90);
		setProperty (instanceName, _width, 60);
		startPosition +=70;
	}

SCRIPT 2

on (release) {
_root.numberOfPictures = 7;

	for (x=1; x<=numberOfPictures; x++) {

	instanceName = "mcThumbnail0" + x;
	setProperty (instanceName, _height,90);
	setProperty (instanceName, _width, 60);
	}	

}

You can see I am doing the exactly same thing! :scream: . Now however it actually works. As I want to the flash file to run by itself without the need to press a button I need to find the reason why it doesn`t work right away.

Do I need to add a delay?

I tried putting the button script on a later keyframe without success.

What am I doing wrong? :ninja:

I figured it out.

In a later frame I need to check if the JPGs are fully loaded. Only then I can resize them.

Code in the 5th frame:

for(x=1;x<=7;x++) {
instanceName = “mcThumbnail0” + x;
if(instanceName.getBytesLoaded() != instanceName.getBytesTotal())
gotoAndPlay(4);
else {
setProperty(instanceName,_height,“90”);
setProperty(instanceName,_width,“60”);
}
}