4 Replies Latest reply on Jan 22, 2008 2:40 AM by Walter Elias

    Scale bitmap

    Walter Elias Level 2
      I thought this would be simple but I can't figure it out. I am using a for loop to import a series of jpegs to lay out as thumbnails. The client requires that I load the full-size images and have them auto-scale down to thumbnail size, then animate to full size on clicking. I just can't get the dynamically loaded images to resize. I've tried importing them and then using script to resize the movie clips they're imported into, but that doesn't seem to work.

      The originals are 400 x 300 and I want the scaled down thumbnails to be 125 x 94.

      I know I'm going to feel really stupid when someone points out the solution. But that's okay, my kids call me stupid and worse every day.
        • 1. Re: Scale bitmap
          niki tsanov Level 1
          Use MovieClipLoader if you want to load dynamicli because there method have function like onLoadInit and with this you can control your images for example see this code or just see this for other functions
          http://livedocs.adobe.com:80/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?c ontext=Flash_MX_2004&file=00001577.html


          mcLoader:MovieClipLoader=new MovieClipLoader();
          MovieClipListener:Object=Object();
          MovieClipListener.onLoadInit=function(Target:MovieClip)
          {
          mc._width=Your Width;
          mc._height=Your Height;
          mc._x=X pos
          mc._y=yPos;
          mc.onRollOver=function()
          {
          mc._width=Original Width
          .....
          }
          }
          • 2. Re: Scale bitmap
            Walter Elias Level 2
            Thanks. I'm a bit confused, and the Adobe LiveDocs page has an example so complicated that I can't figure it out. I'm not that much of a beginner with ActionScript, but often the examples in the Help files are overly complex. Do I still use loadMovie to load the jpegs into the movie clips?

            Can you give me an example of loading gallery1.jpg into a movie clip with the instance name "thumb1", and then scaling it to 35 percent of original size?
            • 3. Re: Scale bitmap
              niki tsanov Level 1
              // Define MovieClipLoaer and Listener
              var mcLoader:MovieClipLoader = new MovieClipLoader();
              var loaderList:Object = new Object();
              mcLoader.addListener(loaderList);
              // Create new movieclip to store the loaded picture
              this.createEmptyMovieClip("Thumb1", this.getNextHighestDepth());
              // Statements
              loaderList.onLoadInit = function(mc:MovieClip) {
              mc._width = thumbWidth;
              mc._height = thumbHeight;
              mc._x = xPos;
              mc._y = yPos;
              mc.onRollOver = function() {
              mc._width = bigWidth;
              mc._height = bigHeight;
              };
              };
              // Load picture
              mcLoader.loadClip("1.jpg", Thumb1);
              • 4. Re: Scale bitmap
                Walter Elias Level 2
                I had to put this project aside for a few days. But now I've tested it and it works beautifully. I just wanted to say thank you, Niki.