Skip to main content
May 4, 2012
Answered

Move on to the next scene after FLV ends

  • May 4, 2012
  • 2 replies
  • 5583 views

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();

    

}

This topic has been closed for replies.
Correct answer iFlashAppsToo

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.


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

       }

}

2 replies

Inspiring
May 4, 2012

at the bar

Ned Murphy
Legend
May 4, 2012

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.

May 4, 2012

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.

Ned Murphy
Legend
May 4, 2012

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