2 Replies Latest reply on Sep 6, 2006 3:34 PM by Rothrock

    MovieClip size detection

    shorste
      If you load a movie clip with a jpeg using loadMovie the _width and _height properies are 0. the getBounds method returns some huge fixed value. Can anyone tell me how to determine how big a loaded jpeg is? Thanks.
        • 1. Re: MovieClip size detection
          ewon15 Level 1
          i think you can use this and either trace it (like i have) or put use it for something more practical:

          trace(getBytesLoaded("yourFile.jpg"));
          • 2. Re: MovieClip size detection
            Rothrock Level 5
            The pixel dimensions are not known until the file is completely loaded. If you are using the MovieClip.loadMovie() method you will have to make some code that checks the getBytesLoaded() and getBytesTotal() to figure out when the whole thing is loaded. This is called preloading and there are dozens of tutorials and all kind of posts here about it. So check that out and post back if you have some specific questions.

            If you are publishing for Flash 7 or higher there is another way: the MovieClipLoader() class. This class sort of rolls up the whole preloading issue into a neat blanket. You can use events – such as the onLoadInit – to do various things as they are needed. Check it out in the help files they give you all the code you need. You will want to use the onLoadInit event and not the onLoadComplete to measure your _width and _height