1
votes

I hope I won't sound like an idiot, but this is my problem - I imported an SWF video file, it's an instance of FLVPlayback, named the instance 'video'. I need to invoke some method when the video playback is completed. So the question is - how can I do something when FLVPlayback ends?

Using Flash CS 5.5, actionscript

Code I use:

video.addEventListener(VideoEvent.COMPLETE, playbackComplete);

function playbackComplete(event:VideoEvent):void
{
     gotoAndStop(1,"Scene 2");
}

When I try that, I get:

Scene 1, Layer 'Layer 1', Frame 1, Line 1 1119: Access of possibly undefined property COMPLETE through a reference with static type Class.

1

1 Answers

0
votes

You can use the complete event of the class FLVPlayback.

video.addEventListener(VideoEvent.COMPLETE, playbackComplete);

function playbackComplete(event:VideoEvent):void
{
     // code here
}

However, notice that the documentation says:

Dispatched when playing completes because the player reached the end of the FLV file. The component does not dispatch the event if you call the stop() or pause() methods or click the corresponding controls.

So you will need to listen to other events if you need to handle these scenarios too.

EDIT

Try changing the code into:

video.addEventListener(Event.COMPLETE, playbackComplete);

function playbackComplete(event:Event):void
{
     gotoAndStop(1,"Scene 2");
}