Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : Any way to get dimensions of JPEG in Flash?


www.flashforabuck.com
2/9/2004 8:25:58 PM
Hey edrrmwc,

What Flash version are you using?

visit my site www.flashforabuck.com or email me at admin@flashforabuckc.om

-Max
www.flashforabuck.com

[quoted text, click to view]
edrrmwc
2/9/2004 9:16:50 PM
I'm using loadMovie() to load a series of images (JPEG) into Flash. I'd like
to get the height and width of the JPEG after the load to scale it properly,
but I can't seem to figure out how

Doin

form_mc.createEmptyMovieClip("viewer_mc", 50)
viewer_mc.loadMovie(filename)

loads the picture without problem, but then looking at either
viewer_mc._height or ._width just returns 0 for any image. I've tried it with
HTML text in a text box and get the same problem: it will only return the size
of the text box as created, not the rescaled size

Is there something I'm missing
CesareRocchi
2/10/2004 11:40:56 AM
Sure that the image is 'completely' loaded?
your code seems fine

edrrmwc
2/10/2004 3:04:21 PM
Yes, the image is loaded. I've gone so far as to use the MovieClipLoader
feature to only trigger getting height and width after the image is completely
loaded. (and even beyond that in case of bug, I've had it report when I click
a button after I can verify load with my eyeballs.
CesareRocchi
2/10/2004 4:15:06 PM
Try this:

form_mc.viewer_mc.loadMovie(filename);

perhaps you don't refer correctly to viewer_mc

HTH,

AddThis Social Bookmark Button