5 Replies Latest reply on Jan 27, 2010 6:13 AM by TerraAustralis

    Space images in Horizontal scroll

    TerraAustralis Level 1

      Being new to AS and Flash 8 I am using an online tutorial as a guide to the creation of a horizontal mouse driven scrolling gallery.

       

      I was hoping to use the model script and make simple adjustments of file names and loading specs but it has gone beyond my simple understanding.

       

      I have 64 images which need to load 50 pixels apart starting with a 50 pixels pace. The image sequence will loop. Each image is of constant 385 pixels deep but widths vary and I hoped AS could load them in sequence at 100% instead of using a finite number for the width. The attached file shows the gallery images at bottom right, loaded but all stacked upon each other with the last image uppermost.

       

      Code so far:

      this.createEmptyMovieClip("container",1);

       

      var imagesNumber:Number = 64;

      var baseX:Number = 0;

      var spacing:Number = 50;

       

       

      for (i=1; i<=imagesNumber; i++) {

      container.attachMovie("image"+i,"image"+i+_mc,i);

      myImage_mc = container["image"+i+_mc];

      myImage_mc._x = baseX

      myImage_mc._y = (Stage.height == myImage_mc.height);

      baseX = baseX + myImage_mc._width + spacing

      }

       

      Once I get the loading process correct I think I can revert to the tutorial model for the rest of the AS.

       

      Can anyone help please?

        • 1. Re: Space images in Horizontal scroll
          kglad Adobe Community Professional & MVP

          myImage_mc._width is zero until loading is complete.

           

          you'll need to use preloader code or the moviecliploader class and load your images sequentially.

          1 person found this helpful
          • 2. Re: Space images in Horizontal scroll
            TerraAustralis Level 1

            Thanks for the guidence kglad.

            Loading images sequentially? Does that mean AS code cannot load variable image widths except by explicit measurement? or are other factors involved?

            • 3. Re: Space images in Horizontal scroll
              kglad Adobe Community Professional & MVP

              wait a minute.  you're not loading anything.  all your images are in your library so myImage_mc._width is available immediately.

               

              there's some other problem:  the _x and _y properties you're trying to assign don't look correct.  what are you trying to do with that code.

              • 4. Re: Space images in Horizontal scroll
                Harry Kunz Level 4

                Technically it's not a loading process because the contents are already loaded before you even call the attachMovie method. Do you want to load the images from an external source directory instead or are they in your library? FYI, you have some lines to correct, like container.attachMovie("image"+i,"image"+i+_mc,i); which results in "_level0.container.image1undefined". Put the _mc in quotation marks to convert the undefined to a string "_mc". And the myImage_mc.height should be myImage_mc._height. If you are trying to load the files from an external directory, you should use the MovieClipLoader class.

                1 person found this helpful
                • 5. Re: Space images in Horizontal scroll
                  TerraAustralis Level 1

                  Thank you both for the response guys.

                   

                  The code above is part of a tutorial describing the AS to create a mouse driven scrollable gallery. The tute uses thumbs and clicks to a larger image window from each thumb. I simply wanted to create a gallery of images straight out of the fla Library to a standard height. I figured the exercise would allow me to engage constructively with AS in a real project. the code is only the first part of the tute project. I changed the code image names to suit my files and the fact that the model has thumbs and images suggests I may have rendered some code unusable or redundant and caused a malfunction in the Test. Yup, I am trying to run before I can walk and the points you guys have made illustrate the need for me to assemble specific code models instead of trying to adapt code at this stage when I know so little.

                   

                  I want to sincerely thank you guys for your helpful responses. I shall check out each code element again in the light of your observations. I very much appreciate your detailed observations.