3 Replies Latest reply on Dec 3, 2007 10:14 PM by Greg Dove

    get dynamically loaded image size

      i am dynamically loading jpgs from an xml file in a photogallery. i need to get the width and height of the image, as well as force the image to load into the center of my movie clip (currently it is loading the top left corner of the image into the top left corner of the movie clip...i am allowing the user to drag the image, but want it loaded into the middle).
      this is urgent, so any help is greatly appreciated!
        • 2. Re: get dynamically loaded image size
          sirtcarlos Level 1
          thanks for the quick response...however, maybe cause it's late, but i'm still not getting it.
          i already had code loading images from an xml file, however now the images arent displaying. here is my code:
          myPhoto = new XML();
          myPhoto.ignoreWhite = true;
          myPhoto.onLoad = function(success) {
          numimages = this.firstChild.childNodes.length;
          spacing = 80;
          scrollwidth = numimages*80;
          swidth = numimages*80;
          for (i=0; i<10; i++) {
          this.picHolder = this.firstChild.childNodes ;
          this.picHolder.onLoad = this.firstChild.childNodes
          this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
          this.thumbHolder._x = i*spacing;
          this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
          this.thumbHolder.chapelmain = this.picHolder.attributes.chapelmain;
          this.thumbHolder.onRelease = function() {
          myPhoto.load(" http://urltoxml.xml");

          can you help as to what i'm missing here?
          • 3. Re: get dynamically loaded image size
            Greg Dove Level 4
            You should use the attach Code button to avoid messing up your code formatting and missing out bits of code like that.

            I don't understand:

            this.picHolder.onLoad = this.firstChild.childNodes[ i ];

            I can't see that doing anything good . try commenting that out.

            then put a trace in your onRelease handler for your thumb to check that the large image holder is being correctly referenced.

            this.thumbHolder.onRelease = function() {
            trace(largeImg); // check the output of this in the output panel. Make sure its ok
            ...don't change the rest