This content has been marked as final. Show 2 replies
You need to wait until the external file finishes loading before you can access its width. I'm pretty sure you are using Flash 8 because no other version of Flash can dynamically load a gif file. So if that is the case, I would recommend you use the MovieClipLoader class instead of loadMovie.
loadMovie is an older method that requires you to build your own preloader to check for the finish of loading. Search the forums or the web for a tutorial on how to make a preloader.
With the MovieClipLoader class (check the help files for the code) you will be able to use the onLoadInit event to define your code for checking the size, scaling, and/or whatever else you want to do with the external asset.
If you don't mind I will give you another little tip as well. The createEmptyMovieClip method returns a reference to the newly created clip. So you can assign that to a variable and reuse it. So your code could become.
Neater, huh? Also notice how I have use the MovieClip class method for loadMovie? by putting the clip to load into before the loadMovie it makes it just a bit cleaner and neater – at least to my eye. So many other methods and properties work this way it just makes it nicer.
Thanks a lot Rothrock... get the idea now. Will use MovieClipLoader instead as I can set a function to access the size once it is loaded. Should have thought of this myself.