3 Replies Latest reply on Nov 22, 2006 10:34 PM by Alok Jain

    Resizing Images

    Alok Jain Level 1
      Hi

      How can i resize a dynamically loaded image in flash?

        • 1. Re: Resizing Images
          tiago.braga Level 1
          Yes, you can... but first you need to make sure that the image was loaded.

          so, on this.new_mc.getBytesLoaded() == this.new_mc.getBytesTotal() you can set the action.

          the code below works fine:
          ---
          this.createEmptyMovieClip("new_mc", this.getNextHighestDepth());
          this.new_mc.loadMovie("testimage.jpg");

          _root.onEnterFrame = function()
          {
          if(_root.new_mc.getBytesLoaded() == _root.new_mc.getBytesTotal() && _root.new_mc.getBytesLoaded() > 0)
          {
          delete _root.onEnterFrame;
          _root.new_mc._xscale = _root.new_mc._yscale = 15;
          }
          }
          ---
          • 2. Re: Resizing Images
            Marghoob Suleman Level 1
            Hi There,
            Its better to use loadClip() rather than loadMovie().

            and you can set or get the height or width on onLoadInit.
            • 3. Re: Resizing Images
              Alok Jain Level 1
              Thanks for help

              with _xscale and _yscale i found that it makes problem when i am using different size of images. because it sets the size in percentage. I used height and width instead.

              Another problem i found is proportion of images. Here is the final code that resizes the images proportionately.