Dinamicaly Loading Images

I have a little problem.
Loading external .jpg file in to the movie clip is not the problem,
butt geting picture size is.
It looks like the size of the movie clip, in which I am loading image, is not changing at all, it stays 100×100 pix no mather what size is the picture.
I would like to know how can I get picture or movieclip size (_xscale,_yscale) so I can manipulate with it.
Help
(-: (-: :q: :q:

the _xscale and _yscale are percentages of the actual width/height of the movieclip. The movieclip could start out being 10x10 and then jump to 200x400 if you load a movie into it, but its _xscale and _yscale will stay the same (most likely 100 unless it was changed) because it represents a percentage of the original. when it was 10x10 then it was 100% its original size, which is 10x10. Once that movieclip gets a 200x400 image loaded into it, its still 100% its original size because now its original size is 200x400. To get the actual dimensions, you’d use _width and _height, they are the properties which reflect either 10x10 or 200x400. once you load an image into an unadjusted movieclip, it will take on the size of the actual image. From there you can adjust the _xscale or _yscale or the _height or _width to change it to whatever you want.

I had the same problem, look at the following thread it will explain everything and give you exactly what you want.

http://www.kirupaforum.com/showthread.php?threadid=11567

Thank guys, but a need one more thing.

How can I get _xscale and _yscale of loaded picture.
I am loading pictures in the movie clips (created with creatEmptyMovieClip) which are alined in one row like in the infinite menu, but dinamicaly.
I need _xscale of container in witch are this movie clips with loaded pictures so I can set boudaries for moving container clip like in infinite menu.
Boudaries must be dinamicaly set too so I can load as many pictures as I want in my menue.

Howdy…

When you dynamically load image files into the empty movieclip in Flash, _xscale and _yscale resets to 100 when the image is fully loaded… Now, I don’t think this is what you want… Maybe you want to know _width and _height of the movieclip instead to resize the border???

Try this code… This code WILL NOT get the image dimension before the loading… It checks if the external image is loaded or not and when it is FULLY loaded, it will trace out the dimension of the loaded image file… If you need to know the dimension before you actually load the image file, you will have to use server side script to return you the dimension…

_level0.createEmptyMovieClip("tester", 1);
_level0.tester.loadMovie("testOnLoad.jpg");
_level0.onEnterFrame = function ()
{
	if (_level0.tester._width)
	{
		trace("_level0.tester._width = " + _level0.tester._width);
		trace("_level0.tester._height = " + _level0.tester._height);
		delete _level0.onEnterFrame;
	}
}

This is what I was looking for.
When I finish my dinamicaly created infinite menu I will post the source.
Thanks again.
=) =) =) =)

:rambo:

Here is the finished menu.

Dinamicaly xml menu

Well I am thinking about writing a tutorial bout my FLA file and the use of XML.
Here are those two files sou you can download them and take a look inside.

FLA
XML
:slight_smile: :slight_smile: :slight_smile:

Hi tstefan,

Can you please explain what this line of code is doing. Especially the “_root.container=_width”, is the _width from the container or
barimg?

thanks.

if (_root.container=_width){
_root.barimg.onEnterFrame = function() {
bytes_loaded = _root.slika.getBytesLoaded();
bytes_total = _root.slika.getBytesTotal();
getPercent = Math.round(bytes_loaded/bytes_total100);
getPercenttext=getPercent+"%";
this._width=getPercent
1.91;

};
}

Oopsie…

That line should be read
if (_root.container == _width){
Double equals(==), not single equal(=) within the if statement to check the condition…

is the _width from the container or
barimg?

_width in that case aplies to the object that this code is placed on.

PS - tstefan: Nice. Clean and functional. And welcome to Kirupa from me. Love the Croatians. (Im dating a grand daughter of your country.)

I am glad that you like my work, and I will try to post more of my work.

PS.
Send my hello to grand daugther of Croatia, David.

=) =) =) =) :beam: