6 Replies Latest reply on Jun 11, 2010 1:25 PM by SpiritOfTheWinds

    Slideshow in AS2

    SpiritOfTheWinds

      I've got another problem, and this time, with the slideshow. I thought I could work out something with the code already in the flash, but I can't seem to start a new slideshow from it... And the searches are again not really helpful. I don't find what I really need...

       

      I currently have this:

       

      After my array is created, I use the Activate_Image(current_image (0), myArray.length) to start the slideshow. But I guess i'm missing an important part...

       

      function Activate_image(current_image,total):Void
      {
            myTween = new TweenLite(pub_loader, 2, {_alpha:0,delay:10, onComplete:change_image, onCompleteParams:[current_image,total]});
      }

       

      * pub_loader is a "Loader" MovieClip that I took from the already existent Loader in the Library and put it into a new frame. I'm not sure about if it's good or not cause I never used this kind of things before. I may need someone to point out what there should be in my frame? So, after the activate is done, there's the change_image(index, length) that's activating. I may need to link it to the Loader I've put in my

       

      function change_image(current_image,total):Void
      {   
          var mcLoader = new MovieClipLoader();
         
          mcLoader.onLoadInit = function(target_mc:MovieClip, status:Number):Void
          {
              //On smooth l'image.
              target_mc._visible = false;

       

              var bitmap:BitmapData = new BitmapData(
                  target_mc._width,
                  target_mc._height,
                  true);

       

              target_mc.attachBitmap(
                  bitmap,
                  target_mc.getNextHighestDepth(),
                  "auto",
                  true);

       

              bitmap.draw(target_mc);
              
              target_mc._visible = true;
             
              if(current_image  >= total - 1)
              {
                  current_image = -1;
              }
             
              if(total != 1)
              {
                    myTween = new TweenLite(
      pub_loader, 2, {_alpha:100, onComplete:Activate_image, onCompleteParams:[current_image+1,total]});
              }
              else
              {
                    myTween = new TweenLite(
      pub_loader, 2, {_alpha:100});
              }
          }

       

          mcLoader.loadClip(sujet_image_borne[current_image], _root.cadre.image_loader);
      }

       

      Thanks for any head-ups and tips on how to get a nice slideshow. For informations, I simply need a slideshow that slides up (with fading) all the images one after one for X (delay set with variable, currently hardcoded as 10) seconds and when it reaches the lenght, continue at the first image. The slideshow must be placed at the bottom of my flash, since it's just a part of it (not full screen).

       

      Oh and if there's only one image, there is then no slideshow (no animation), simply one permanent image shown (as seen in the "if(total != 1)").

       

      Again, I don't know if the "pub_loader" thing is good... :S

       

      Thanks!

        • 1. Re: Slideshow in AS2
          kglad Adobe Community Professional & MVP

          what's the question or, what's the first problem?

          • 2. Re: Slideshow in AS2
            SpiritOfTheWinds Level 1

            Well, as shown in the previous post, I want to know if my code will work or is something missing? There's nothing showing...

             

            Also, I thought that it may be due to my control. I mean, The "Target" of the Tweenlite must be a Movieclip right? What must it contains?

             

            Or if you have a better way of proceeding...?

             

            I currently took the code from another flash but I'm not familiar with it...

            • 3. Re: Slideshow in AS2
              kglad Adobe Community Professional & MVP

              there's a lot missing from that code.  what you posted looks like a small part of the coding needed.

               

              and the target doesn't have to be a movieclip.  tweenlite can handle a number of objects.

              • 4. Re: Slideshow in AS2
                SpiritOfTheWinds Level 1

                 

                 

                Could you provide me some code to "complete" what I posted? I took all the code used in a flash which has a slideshow, but since there are over 3500 lines of code, I may have missed something...

                 

                (I also forgot to change something in it:

                mcLoader.loadClip(sujet_image_borne[current_image],  _root.cadre.image_loader);

                should be:

                mcLoader.loadClip(myImages_array[current_image], pub_loader); )

                 

                Here's the "first part" of the coding:

                 

                function reload_me():Void
                {
                    myImages_array = [];
                    myDelay = 5;
                    img = 0;
                    rnd = Math.floor(Math.random()*100000000);
                    url = site_root + "/myhandler.ashx?id=" + _root.myid + "&rn="+rnd;

                 

                    var sendLV:LoadVars=new LoadVars();
                   
                    var receiveLV:LoadVars=new LoadVars();
                   
                    receiveLV.onData=function(src){
                        myImages_array = src.split("|");
                        Activate_image(0, myImages_array.length);
                    }
                   
                    sendLV.sendAndLoad(url,receiveLV,"POST");
                }

                 

                So I have all my images in the myImages_array (thanks to you), and then I use the Activate_image function with the first index and the max lenght. I thought that there was nothing missing from my code, but I guess I'm really missing something... :S

                • 5. Re: Slideshow in AS2
                  kglad Adobe Community Professional & MVP

                  use google to search for:  flash as2 slideshow tutorial

                  • 6. Re: Slideshow in AS2
                    SpiritOfTheWinds Level 1

                    I've used that already and I don't find anything that can help me with it... oh well, I guess I'll have to use another method...