# STRESS! Resizing imported jpegs

**URL:** <https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803>\
**Category:** Uncategorized\
**Created:** [July 21, 2004, 4:06pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803 "2004-07-21T16:06:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![brasso](https://avatars.discourse-cdn.com/v4/letter/b/3da27b/32.png) [@brasso](https://forum.kirupa.com/u/brasso)\
**Post date:** [July 21, 2004, 4:06pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/1 "2004-07-21T16:06:41Z")

</div>

Hi everybody,

I am VERY new to actionscripting and have got myself into a bit of a muddle. I am trying to import a jpeg image into an empty movie clip and then resize the image. I can scale it, and position it but I can’t resize it.

Somebody suggested creating a movieclip in Flash first and giving it an instance name. Then use loadMovie to place the jpeg into that movieclip. This did work and allowed me to resize it but only the movieclip would be resized which in turn resized the image proportionally. I still couldn’t specify exact dimensions of the image - only the movieclip. I hope this makes sense… I think I’ve lost myself!!

Any ideas of help would be greatly appreciated.

Many thanks in advance

Brasso

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:25pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/2 "2004-07-21T16:25:21Z")

</div>

> I can scale it, and position it but I can’t resize it.

What’s the difference between Scale and Resize?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:43pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/3 "2004-07-21T16:43:48Z")

</div>

I’d love to help too, but I dont get the question

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:43pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/4 "2004-07-21T16:43:58Z")

</div>

When scaling a movieclip you use \_xscale and \_yscale and specify them as percentages.

I want to use \_width and \_height and give the movieclip exact dimensions in pixels…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:48pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/5 "2004-07-21T16:48:09Z")

</div>

If you are loading the pic into a container, can’t you just modify the width and height of the container MC once you know the pic has fully loaded?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 4:51pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/6 "2004-07-21T16:51:47Z")

</div>

> [@Ordinathorreur](#):
>
> If you are loading the pic into a container, can’t you just modify the width and height of the container MC once you know the pic has fully loaded?

That’s what I thought but it doesn’t appear to be working! Here is my code:

* * *

this.createEmptyMovieClip(“cab”,-100000)  
cab.onData=function(){  
trace(“hey”)  
}  
cab.onLoad=function(){  
trace(“loaded”)  
cab.\_x=10;  
cab.\_y=80;

## } cab.loadMovie(“images/test.jpg”);

Like I said, I can position it and scale it but when I try and resize it using cab.\_width and cab.\_height the image just disappears!!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 6:39pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/7 "2004-07-21T18:39:44Z")

</div>

```auto
this.createEmptyMovieClip("cab", 1);
cab.loadMovie("images/test.jpg");
tmp = cab.createEmptyMovieClip("temp", 100);
tmp.onEnterFrame = function() {
	t = cab.getBytesTotal();
	l = cab.getBytesLoaded();
	if (t == l && t != 0 && cab._width>0 && cab._height>0) {
		cab._x = 10;
		cab._y = 80;
		trace(cab._width+" + "+cab._height);
		delete this.onEnterFrame;
	}
};

```

Like Ordinathorreur has said;)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2004, 8:25am UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/8 "2004-07-22T08:25:28Z")

</div>

> [@scotty](#):
>
> ```auto
> 
> if (t == l && t != 0 && cab._width>0 && cab._height>0) {
> 
> ```

Hi Scotty,

Thanks for the reply. However I’m still having problems. There seems to be a problem with the IF statement. It never returns true. Should there be some sort of loop to test how much of the movieclip has loaded?

Cheers

Brasso

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2004, 4:15pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/9 "2004-07-22T16:15:32Z")

</div>

Can you post your fla?

scotty(-:

---

<div class="post-metadata">

**Author:** ![Jerryscript](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jerryscript/32/451_2.png) [@Jerryscript](https://forum.kirupa.com/u/Jerryscript)\
**Post date:** [July 27, 2004, 4:02pm UTC](https://forum.kirupa.com/t/stress-resizing-imported-jpegs/116803/10 "2004-07-27T16:02:17Z")

</div>

I always have trouble testing getBytesTotal against getBytesLoaded with jpeg loads as well, so in Scotty’s code, I would just leave out the t==l. Since the width and height aren’t set till it is loaded anyway, their checks should be sufficient. Try

```auto
if (t == l && t != 0 && cab._width>0 && cab._height>0) {

```
