11 Replies Latest reply: May 4, 2012 4:26 PM by iFlashAppsToo RSS

    Move on to the next scene after FLV ends

    Formation_2 Community Member

      Before you say anything, I have searched every single thread on the internet and still can't get it to work.  I'm sure this is an easy fix for someone who knows Flash very well.  So in my project I have this FLV video embeded and I want it to move to the next scene/frame when it ends.  I'm using AS3 btw.  This is what my code looks like at the moment. So all I want is that when the FLV video ends, it automatically moves on to the next scene or frame.  Thanks in advance.

       

       

       

      stop();

      skipintro.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

       

      function fl_ClickToGoToScene(event:MouseEvent):void

      {

          MovieClip(this.root).gotoAndPlay(1, "Scene 2");

         

      }

       

      introvideo.addEventListener(Event.REMOVED_FROM_STAGE, stopPlay);

      function stopPlay(e:Event)

      {

            introvideo.stop();

          

      }

        • 1. Re: Move on to the next scene after FLV ends
          Ned Murphy CommunityMVP

          If you are using an FLVPlayback component then assign a listener for the COMPLETE event and have the event handler function deal with advancing down the timeline.

          • 2. Re: Move on to the next scene after FLV ends
            Formation_2 Community Member

            Ned, thanks for taking your time to help me.  I tried doing that before but it didn't work, and maybe I was doing it wrong so who knows.  Could you tell me what the code would look like? Thanks again.

            • 3. Re: Move on to the next scene after FLV ends
              Ned Murphy CommunityMVP

              Show the code you tried that didn't work and explain it.

              • 4. Re: Move on to the next scene after FLV ends
                Formation_2 Community Member

                I showed the code in the very first post, can't you see it? I'll post it again.  So the video is ~3 minutes long and I have provided the viewer an option of skiping the video and going straight to the content and this works fine.  What doesn't work is if the viewer doesn't click the skip button, the video will play until the end but it won't move on to the next frame, it will just stay there and I want it to automatically move on to the next frame by itself.  Thanks again.

                 

                 

                stop();

                skipintro.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

                 

                function fl_ClickToGoToScene(event:MouseEvent):void

                {

                    MovieClip(this.root).gotoAndPlay(1, "Scene 2");

                 

                }

                 

                introvideo.addEventListener(Event.REMOVED_FROM_STAGE, stopPlay);

                function stopPlay(e:Event)

                {

                      introvideo.stop();

                 

                }

                • 5. Re: Move on to the next scene after FLV ends
                  Ned Murphy CommunityMVP

                  I saw that code but it is not assigning a COMPLETE event listener.  You said you already tried doing that before, so I guess you didn't understand what I said to do...

                   

                  import fl.video.VideoEvent;

                   

                  stop();

                  skipintro.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

                   

                  function fl_ClickToGoToScene(event:MouseEvent=null):void

                  {

                      gotoAndPlay(1, "Scene 2");

                   

                  }

                   

                  introvideo.addEventListener(VideoEvent.COMPLETE, stopPlay);

                  function stopPlay(e:Event)

                  {

                       introvideo.stop();

                       fl_ClickToGoToScene();

                  }

                  • 6. Re: Move on to the next scene after FLV ends
                    Formation_2 Community Member

                    No, I totally understood what you said and I tried it with a COMPLETE event lister and it wasn't working that's why I decided to create a thread about it. I'm not really an expert on this sort of stuff so I might need baby steps. Which part of my code do I need to change? Thanks in advance.

                    • 7. Re: Move on to the next scene after FLV ends
                      Ned Murphy CommunityMVP

                      You seem to have a reading comprehension issue of some sort... not intended as an insult, but you really oughta read thru this thread after you're done with it to see what I mean. 

                       

                      I said to use a COMPLETE listener.  You said you tried that before and it didn't work. So I asked you to show what you tried before that didn't work and you showed me what you already showed instead. 

                       

                      Now you are asking me to show you the code that needs changing...  I just did.

                      • 8. Re: Move on to the next scene after FLV ends
                        Formation_2 Community Member

                        Before I made this thread, I searched on Google and saw that some people were using a COMPLETE listener to get this to work so I copied and pasted it into my project from some random guy on the internet and changed the function name and all that other stuff to make it work with my video but I must have obviously done something wrong because it didn't work.  I then deleted the code and went back to my original code/file because I saw no reason in keeping something that doesn't work.  Now, when you asked me to show you what I tried before, I had already deleted the code and had gone to the original file so I had no idea where to find it again and show you.  Coding isn't really thing so I might be getting confused here with what you are asking me to do.  When you say "use a COMPLETE listener", I have no idea where to start because I don't memorize these sort of stuff and I just copied and pasted it from some guy on the internet when I used it on my project.

                        • 9. Re: Move on to the next scene after FLV ends
                          iFlashAppsToo Community Member

                          you said:

                          in my project I have this FLV video embeded

                           

                          this suggests to me that you imported your video into your flash file... so read this link:

                          http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSBDABD69F-D146-4e5c-9340-BF717A10426C.h tml

                           

                          specifically:

                           

                          A best practice is to place video inside a movie clip instance, because you have the most control over the content. The video’s Timeline plays independently from the main Timeline. You do not have to extend your main Timeline by many frames to accommodate the video, which can make working with your FLA file difficult.

                           

                           

                          so you may want to control the timeline of the movieclip your video is embedded in like this...

                           

                          videoMc.addEventListener(Event.ENTER_FRAME, goNext);

                           

                          function goNext(e:Event){

                                if(videoMc.currentFrame == videoMc.totalFrames){

                                      //go to next scene or frame

                                 }

                          }

                          • 10. Re: Move on to the next scene after FLV ends
                            Formation_2 Community Member

                            I finally got it to work, thanks iFlashAppsToo. Where were you all this time.

                            iFlashAppsToo wrote:

                             

                            you said:

                            in my project I have this FLV video embeded

                             

                            this suggests to me that you imported your video into your flash file... so read this link:

                            http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSBDABD69F-D146-4e5c -9340-BF717A10426C.html

                             

                            specifically:

                             

                            A best practice is to place video inside a movie clip instance, because you have the most control over the content. The video’s Timeline plays independently from the main Timeline. You do not have to extend your main Timeline by many frames to accommodate the video, which can make working with your FLA file difficult.

                             

                             

                            so you may want to control the timeline of the movieclip your video is embedded in like this...

                             

                            videoMc.addEventListener(Event.ENTER_FRAME, goNext);

                             

                            function goNext(e:Event){

                                  if(videoMc.currentFrame == videoMc.totalFrames){

                                        //go to next scene or frame

                                   }

                            }