1 Reply Latest reply on Dec 3, 2008 7:12 AM by krustafarian

    multiple jpg variables

    krustafarian
      see here:
      this is a visual example of what i want to do

      it's a movieclip with a scrollbar (make browser smaller to see)
      on entering frame the blocks on the left need to load external jpegs (1.jpg, 2 jpg etc..) with a preloader - but they will all be different heights - so i need to somehow tell once loaded first jpeg to get height then load next jpeg below and so on.
      also the number of jpegs wil be undefined - i might use 1, or i might use 20.

      i'm a designer - really no good at coding - can someone help me out? (using AS2 - flash mx2004).

      the file i've got so far is here:

      much appreciated - thanks in advance.
        • 1. Re: multiple jpg variables
          krustafarian Level 1
          ok so i found this which should work in theory:

          for (var j=1; j<20; j++) {
          imgstrip.createEmptyMovieClip("img_"+j, j);
          imgstrip["img_"+j].loadMovie("img_"+j+".jpg");

          var prevheight = imgstrip["img_"+(j-1)]._height; //should get the height of the previously loaded image
          var prevy = imgstrip["img_"+(j-1)]._y;
          var ypos = (prevheight+prevy+1);

          imgstrip["img_"+j]._y= ypos; //should position next image at the bottom of the last
          imgstrip["img_"+j]._x= 0;
          trace (prevheight);
          }

          but the files load slow so the movieclip height is always 0:
          apparently the following would fix the problem:


          var my_mcl:MovieClipLoader = new MovieClipLoader();
          var mclListener:Object = new Object();

          mclListener.onLoadProgress = function(target_mc:MovieClip,numBytesLoaded:Number,numBytesTotal:Number):Void {
          var pctLoaded:Number =Math.ceil(100*(numBytesLoaded/numBytesTotal));
          // This will get you the percent amount loaded for use in a preloader, etc...
          };
          mclListener.onLoadInit = function(mc:MovieClip):Void {
          trace("LoadInit Rules!"+mc._height); // This is the method that will return the proper values for height/width

          }

          my_mcl.addListener(mclListener);
          my_mcl.loadClip(imageVariable, MovieClipToLoadImageInto);


          but i don't know how to implement it into my file. can someone help!?