[F5]Find dimensions of a movie

Hi!

I have a problem with this code…I want orgScreenShot.swf to play when a button is pressed and I also want to know the dimensions of the movie.

The following code results in mwidth and mheight =0. Howcome?
(container is an empty movie clip…)

on (release) {
loadMovie (“orgScreenShot.swf”, “container”);
mwidth=container._width;
mheight=container._height;
}

How come??? Because your external SWF file, orgScreenShot.swf, gets loaded into the movieclip, container, and 0.000000000…00001 seconds later you are asking the Flash to get the size of the movieclip on which Flash doesn’t get a chance to get the orgScreenShot.swf file FULLY loaded, so you are getting no real value for it… To get the true value, you will have to create a loop that checks if the movie is fully loaded or not and when the external movie file is FULLY loaded, you can then check the size…

Search the forum for more information on how to check if the external file is fully loaded or not…

I changed the code to this.I’m not sure its right.But now mheight and mwidth are not being assigned any values…

on (release) {
loadMovie (“orgScreenShot.swf”, “container”);

_root.onEnterFrame = function ()
{
	if (_root.container._width)
	{
 	                mwidth=container._width;
	mheight=container._height;
                delete _root.onEnterFrame;
	}
	
}

}
:frowning:

Hm… That doesn’t look valid for F5… What do you think??? I don’t remember using onEnterFrame in F5… Hm… Do you get any error message??? You might want to check on the Flash manual for that…

I remember doing the frame loop to check if the external file is loaded or not… There’s gotta be more ways of doing it, but what I did was something like this…
Have the external SWF file loaded in frame 1…
Check the condition in frame 5 and have it go back to frame 2 if the condition is not met, and if it did met, go to frame 10 or something…

You might want to do some searching on the forum… My brain is not what it used to be… :frowning:

Oh… Do us all a favor and use code formatting next time when you post the code… :wink:

Hey ,that solved my problem!I removed onEnterFrame and did just as you suggested.It worked!

Thanks a lot! and I will use code formatting next time!;-)Thanks again.

No problem… :wink: