2 Replies Latest reply on Nov 5, 2009 8:22 AM by moccamaximum

    Flash Slideshow - playpausebutton

    blossom980

      I have created a slideshow based on the template for slideshow provided by Flash and some other blogs posts i have found.

      I have a layer with a picture on consecutive frames.

      I have another later that has just my text to display always.

      I have created another layer called Buttons and in the first keyframe i typed stop();  And added buttons by draging and dropping <back button
      and > foward button. I used script:

      for the back button

      on (release) {
      if (this._currentframe == 1) {
      gotoAndStop (this._totalframes);
      } else {
      prevFrame ();
      }
      }

      and for the foward

      on (release) {
      if (this._currentframe == this._totalframes) {
      gotoAndStop (1);
      } else {
      nextFrame ();
      }
      }

      I have gotten them to work if you hit the button, it changes to the next picture.

      I want the pictures to continously play and i want to add a Pause/Play button .

      If you hit the pause it will stop and then you can resume the slideshow by hitting the button again which will be a Play button.

      I cannot #1 get the show to just move on its own (i guess i have to add additional frames to each photo?)

      I have been searching for a Pause Play button ALLLLL day. Please help.

        • 1. Re: Flash Slideshow - playpausebutton
          lemieuxster

          I do not know of a good drag-and-drop play/pause button but you could make a Play/Pause button that controlled an interval (http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dic tionary646.html) that would advance the frame every given number of seconds. The play/pause button would then either create or stop that interval. You would keep track of the currently playing status with a variable (like var currentlyPlaying;)

          • 2. Re: Flash Slideshow - playpausebutton
            moccamaximum Level 5

            1.From what I understand you got the scope of the buttons wrong.

            I suppose you want to do this:

             

            for the back button

            on (release) {

            //in this case "this._parent" adresses the main timeline
            if (this_parent._currentframe == 1) {
            this_parent.gotoAndStop (this_parent._totalframes);
            } else {
            this_parent.prevFrame ();
            }
            }

             

            //same thing for the fwd button

             

            2.If you find the setInterval function to much effort you can always "cheat" a timer with enterFrame

             

            var timer = 0;

            var playing:Boolean = true;


            //the framerate of your movie

            var framespersecond= 30;

             

            _root.onEnterFrame{

              if(playing){

               timer++;

               if(timer%(5*framespersecond)){

                 dosomethingevery5seconds();

                 //reset timer to reduce counting time

                 timer=0;

              }

            }

            }

             

            function dosomethingevery5seconds():void{

              //go to the next picture after 5 seconds;

            _root.nextFrame();

            }

             

             

            pause_btn.onRelease = function(){

              playing = false;

            }

             

            play_btn.onRelease = function(){

              playing = true;

            }