1 Reply Latest reply on Sep 15, 2006 5:51 PM by Rothrock

    Centering Images in an empty movie clip

    cgulotta
      I am creating a slideshow for a photographer with horizontal and vertical images. I have created an empty movie clip to load the images from an external XML file. The horizontal images load fine, but the vertical ones are aligning to the left of the empty movie clip. Is there a script to write to align all of the images in the center?

      Any help would be greatly appreciated.

      Thanks,
      Christina
        • 1. Re: Centering Images in an empty movie clip
          Rothrock Level 5
          Well the first thing to remember is that once a clip is loaded into it you won't have an "empty" movieclip anymore! :)

          I'm sure you have made it easy on yourself and are using the MovieClipLoader class to load the external images? If not, then do so now.

          That is how images load, the upper left corner of the image is at (0,0) of your movie clip. You can get the width and height of the image and with a little math reposition it . But in any event, you need to wait until the image has loaded completely before you can find out the size of the image. For this you should use the onLoadInit event.