When NetConnection video finishes, move to first frame of presentation

492 Views Asked by At

Good morning and thanks for taking a look. This is AS2, not AS3.

I've used this presentation setup for a couple of years now and I've yet to figure out how to make it jump from the video back to the 1st frame again. I usually just render out an extra few minutes of video that match the first frame, but that's getting annoying. Anyway, here is my setup: First frame has a stop command and the picture. The picture has a simple on(release){ gotoandplay(2);} This works perfectly. First frame setup and code Second frame looks like this: Second frame has the net connection stuff The video is left in the folder since it's about 200mb and linked in via the netconnection.

I would like for the presentation to jump back to frame 1 where the nice title slide is sitting once the video completes playing. I've tried several methods before, but my basic level of this stuff isn't helping me. Is there a listener I can add to this that will detect the end and allow me to gotoAndPlay(1)? Or I can even duplicate it to frame 3..

Thanks!

1

There are 1 best solutions below

3
On

add this code in

ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

private function netStatusHandler(evt:NetStatusEvent):void {
    if (evt.info.code == "NetStream.Play.Stop") {
        gotoAndPlay(1)
    }
}

[EDIT]

// do this instead of the code above
function myCallBack(o:Object):void{
  if (o.code == "NetStream.Play.Complete"){
    gotoAndPlay(1)
  }
}
ns.client = {onPlayStatus: myCallBack}