Size of loaded picture

Hallo everybody,
I need to establish size of picture (*.jpg) loaded in swf file. I used this script for load the picture:

_root.createEmptyMovieClip(picture, 9876);
loadMovie(obrazok.jpg, 9876);
trace(picture._width);

but traced number is always 0 however the real size of picture is 256 x 192. How should I change the script for it works?

[AS]
_root.createEmptyMovieClip(“picture”, 9876);
picture.loadMovie(“obrazok.jpg”);
_root.onEnterFrame = function(){
if(picture.getBytesLoaded == picture.getBytesTotal && picture.getBytesTotal > 0){
trace(picture._width);
}
}
[/AS]

I dont know why but it doesnt work. Output window isnt even opened…

[AS]if (picture.getBytesLoaded() == picture.getBytesTotal() && picture.getBytesTotal()>0) {[/AS]

it makes no change. picture is shown nice but nothing else.

The code works fine. What do you want to do exactly?

exactly? i want to align about 15 different sized pictured loaded with code:
for (i=0; i<87; i++) {
_root.group.createEmptyMovieClip(i, i);
loadMovie(picArray*, i);
setProperty(i, _x, 125*i);
setProperty(i, _y, 0);

}

pictures are good aligned by width because their width is the same. But aligment by height is wrong because it on the top of pic and i want align them on the middle. how can do I this?

You could try something like this, I’m not sure if this would be the best way though.
[AS]clips = [];
for (i=0; i<87; i++) {
clips* = group.createEmptyMovieClip(“pic”+i, i);
clips*.loadMovie(picArray*);
clips*._x = 125i;
}
group.createEmptyMovieClip(“preloader”, 9876);
// change this value to whatever you need
group.preloader.ycenter = 100;
group.preloader.onEnterFrame = function() {
if (clips.length) {
for (i=0; i<clips.length; i++) {
if (clips
._width) {
clips*._y = this.ycenter-clips*._height/2;
clips.splice(i, 1);
}
}
} else {
this.removeMovieClip();
}
};[/AS]
:-\

It works, It really works!!!
Thank you very much for your help. :wink:

You’re welcome. =)