3 Replies Latest reply on Jan 1, 2009 5:20 PM by Ned Murphy

    Finding dimensions of an externally loaded image

    Level 7
      Hi Everyone,

      I'm loading an external .png file into a movieclip using loadMovie, but
      don't want it to show if the image dimensions are greater than 250x85.
      To do this, I have a movieclip (usaLogo) acting as the container for the
      image. After loading the image into usaLogo, I try to get its new dimensions
      (which should be those of the external image), but still get the original
      dimensions.

      Here's the offending code:

      loadMovie("logo.png",usaLogo);
      trace(usaLogo._width); // returns dimensions of movieclip, not of image
      if(usaLogo._width >= 250 || usaLogo._height >=85){
      usaLogo._visible = false;
      }

      Could it be that the image hasn't finished loading by the time the next line
      of code is read? Also, is there a better way of doing this?

      thanks,

      -Chris