# \[MX\] detecting size of loaded image

**URL:** <https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286>\
**Category:** flash\
**Created:** [November 17, 2002, 6:40pm UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286 "2002-11-17T18:40:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deril](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/deril/32/63_2.png) [@Deril](https://forum.kirupa.com/u/Deril)\
**Post date:** [November 17, 2002, 6:40pm UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286/1 "2002-11-17T18:40:11Z")

</div>

Hello,

I have a problem and thought maybe you can help me.

hare is the line I use to load image to movie clip IMG:

```auto
IMG.loadMovie("photoz/"+LPIC[DAIKTYNAS[preinuse]**]);

```

ignore the details…

naw I have to get img size:

```auto

_root.imgheight = ????
_root.imgwidth = ????

```

```
                                                          DERIL
```

---

<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:** [November 17, 2002, 9:18pm UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286/2 "2002-11-17T21:18:00Z")

</div>

I think  
imgwidth =IMG.width;  
imgheight = IMG.height;  
img+width/height are just some variables that’s values are the width and height…  
should be as simple as that…

---

<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:** [November 17, 2002, 10:51pm UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286/3 "2002-11-17T22:51:57Z")

</div>

I tryed it, flash acts as there is nothing 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:** [November 18, 2002, 1:54am UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286/4 "2002-11-18T01:54:34Z")

</div>

Try

imgwidth =IMG.\_width;  
imgheight = IMG.\_height;

The \_ makes all the difference.

Also, an images size registers as 0x0 until it is 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:** [December 3, 2002, 4:26pm UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286/5 "2002-12-03T16:26:41Z")

</div>

hm… I found my mistake.

my code was…

IMG.loadMovie(“photoz/”+LPIC[DAIKTYNAS[preinuse]\*\*]);]  
\_root.imgheight = \_root.IMG.\_width;  
\_root.imgwidth = \_root.IMG.\_height;

but \_width returns empty, becos image is not loaded jet… you have to wait till it will load and then detect size…

thanks for help.

GL.

---

<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:** [December 3, 2002, 5:48pm UTC](https://forum.kirupa.com/t/mx-detecting-size-of-loaded-image/8286/6 "2002-12-03T17:48:29Z")

</div>

Oh ok, so I stated it loaded 0x0 instead of empty… oops, sorry :-\

Well glad you solved it 🙂
