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

**URL:** <https://forum.kirupa.com/t/odd-flash-behavior-can-t-rescale-a-loadmovie-jpg-but-with-button/118339>\
**Category:** Uncategorized\
**Created:** [August 4, 2004, 4:32pm UTC](https://forum.kirupa.com/t/odd-flash-behavior-can-t-rescale-a-loadmovie-jpg-but-with-button/118339 "2004-08-04T16:32:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElvinAtombender](https://avatars.discourse-cdn.com/v4/letter/e/ee7513/32.png) [@ElvinAtombender](https://forum.kirupa.com/u/ElvinAtombender)\
**Post date:** [August 4, 2004, 4:32pm UTC](https://forum.kirupa.com/t/odd-flash-behavior-can-t-rescale-a-loadmovie-jpg-but-with-button/118339/1 "2004-08-04T16:32:14Z")

</div>

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&lt;=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&lt;=numberOfPictures; x++) {

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

```

}

You can see **I am doing the exactly same thing!** 😱 . 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:

---

<div class="post-metadata">

**Author:** ![ElvinAtombender](https://avatars.discourse-cdn.com/v4/letter/e/ee7513/32.png) [@ElvinAtombender](https://forum.kirupa.com/u/ElvinAtombender)\
**Post date:** [August 5, 2004, 7:31am UTC](https://forum.kirupa.com/t/odd-flash-behavior-can-t-rescale-a-loadmovie-jpg-but-with-button/118339/2 "2004-08-05T07:31:59Z")

</div>

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”);  
}  
}
