PDA

View Full Version : [MX] detecting size of loaded image



Deril
November 17th, 2002, 01:40 PM
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:


IMG.loadMovie("photoz/"+LPIC[DAIKTYNAS[preinuse][b]]);

ignore the details..

naw I have to get img size:


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



DERIL

andr.in
November 17th, 2002, 04:18 PM
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...

Deril
November 17th, 2002, 05:51 PM
I tryed it,, flash acts as there is nothing loaded.


:<

lostinbeta
November 17th, 2002, 08:54 PM
Try

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

The _ makes all the difference.

Also, an images size registers as 0x0 until it is fully loaded.

Deril
December 3rd, 2002, 11:26 AM
hm.. I found my mistake.

my code was..

IMG.loadMovie("photoz/"+LPIC[DAIKTYNAS[preinuse][b]]);]
_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.

lostinbeta
December 3rd, 2002, 12:48 PM
Oh ok, so I stated it loaded 0x0 instead of empty... oops, sorry :-\

Well glad you solved it :)