11 Replies Latest reply on Jun 22, 2009 9:53 AM by FStoutamire

    show static image then play 2 .flv

    jenijoss

      I want to have a player that shows a static image to begin with and then plays 2 short .flv files, one after the other and then reverts to the static image.

       

      I've found this, which works beautifully for the static image and one movie clip but I don't know how to add the second movie clip.

       

      startBtn.onRelease = function() {
      // make sure your video has an instance name of vid
      // and it is NOT set to auto play.
      vid.play();
      this._alpha = 0;
      };
      var listenerObject:Object = new Object();
      listenerObject.stopped = function(eventObject) {
      startBtn._alpha = 100;
      };
      vid.addEventListener("stopped",listenerObject);

      listenerObject.playing = function(eventObject){
      startBtn._alpha = 0;
      //Or you can use startBtn._visible = false
      }

      vid.addEventListener("playing",listenerObject);

       

       

      Any help would be very welcome!

      Jeni

        • 1. Re: show static image then play 2 .flv
          kglad Adobe Community Professional & MVP

          if vid is an flvplayback component you can listen for the complete event to play the 2nd video.  set a variable's value if you want to prevent the 2nd video from looping (and check that variable's value before starting the 2nd video).

          • 2. Re: show static image then play 2 .flv
            jenijoss Level 1

            Thank you kglad for the quick response

             

            Yes, vid is the player and I hear what you're saying but my actionscript knowledge is just about non existant so I don't know how to do what you're telling me to do!

             

            Are you able to show me exactly what I need to paste under my existing actionscript?

            • 3. Re: show static image then play 2 .flv
              kglad Adobe Community Professional & MVP

              vid.addEventListener("complete",listenerObject);

               

              listenerObject.complete = function(eo:Object){

              if(!numCompleted){

              numCompleted=1;

              vid.contentPath="secondflv.flv";

              vid.play();

              }

              }

              • 4. Re: show static image then play 2 .flv
                jenijoss Level 1

                oh, that's a beautiful thing - thankyou.

                 

                What can I put at the bottom of all of that so the player rewinds to the start of the first movie. At the moment, when I hit the play button after the second movie has played, it just replays the second movie.

                 

                jeni

                • 5. Re: show static image then play 2 .flv
                  kglad Adobe Community Professional & MVP

                  try:

                   

                  vid.addEventListener("complete",listenerObject);

                   

                  listenerObject.complete = function(eo:Object){

                  if(!numCompleted){

                  numCompleted=1;

                  vid.contentPath="secondflv.flv";  vid.play();

                  } else {

                  vid.contentPath="firstflv.flv";

                  }

                  }

                   

                  p.s.  if your problem is solved, look for some way to mark it as solved/answered.  thank you.

                  • 6. Re: show static image then play 2 .flv
                    jenijoss Level 1

                    thankyou again.

                     

                    that certainly sends the player back to the first movie but it stops after the first movie and doesn't play the second one again. Hitting the play button again, after that, just repeats the first movie. Any idea how I fix that?

                     

                    This is what I've got now:

                     

                    startBtn.onRelease = function() {
                    // make sure your video has an instance name of vid
                    // and it is NOT set to auto play.
                    vid.play();
                    this._alpha = 0;
                    };
                    var listenerObject:Object = new Object();
                    listenerObject.stopped = function(eventObject) {
                    startBtn._alpha = 100;
                    };
                    vid.addEventListener("stopped",listenerObject);

                     

                    listenerObject.playing = function(eventObject){
                    startBtn._alpha = 0;
                    //Or you can use startBtn._visible = false
                    }

                     

                    vid.addEventListener("playing",listenerObject);

                     

                    vid.addEventListener("complete",listenerObject);

                     

                    listenerObject.complete = function(eo:Object){

                     

                    if(!numCompleted){

                     

                    numCompleted=1;

                     

                    vid.contentPath="v4.flv";  vid.play();

                     

                    } else {

                     

                    vid.contentPath="v2.flv";

                     

                    }

                     

                    }

                    • 7. Re: show static image then play 2 .flv
                      kglad Adobe Community Professional & MVP

                      startBtn.onRelease = function() {
                      // make sure your video has an instance name of vid
                      // and it is NOT set to auto play.
                      vid.play();
                      this._alpha = 0;
                      };
                      var listenerObject:Object = new Object();
                      listenerObject.stopped = function(eventObject) {
                      startBtn._alpha = 100;
                      };
                      vid.addEventListener("stopped",listenerObject);

                       

                      listenerObject.playing = function(eventObject){
                      startBtn._alpha = 0;
                      //Or you can use startBtn._visible = false
                      }

                       

                      vid.addEventListener("playing",listenerObject);

                       

                      vid.addEventListener("complete",listenerObject);

                       

                      listenerObject.complete = function(eo:Object){

                       

                      if(!playFirstVideo){

                       

                      playFirstVideo=true;

                       

                      vid.contentPath="v4.flv";

                       

                      vid.play();

                       

                      } else {

                       

                      playFirstVideo=false;

                       

                      vid.contentPath="v2.flv";

                       

                      }

                       

                      }

                      • 8. Re: show static image then play 2 .flv
                        jenijoss Level 1

                        A million thanks for your time and patience!

                         

                        That fixed the problem perfectly

                         

                        regards...jeni

                        • 9. Re: show static image then play 2 .flv
                          kglad Adobe Community Professional & MVP

                          you're welcome.

                           

                          if you see some way to mark this thread as answered, please do so.

                          • 10. Re: show static image then play 2 .flv
                            kglad Adobe Community Professional & MVP

                            oops, i see you already marked it as answered.   (thank you!)

                            • 11. Re: show static image then play 2 .flv
                              FStoutamire

                              Apologies, should have started a new discussion.

                              Message was edited by: FStoutamire