Search code examples
actionscript-3event-handlingflvplayback

AS3 - FLVPlayback component completion handler


I have an FLVPlayback component, instance named flvPlayer. The code below is in frame 1 of intro scene, which works perfectly fine in Flash CS5 but not in CS6! Obviously I want the video player to jump to the next scene when the video reaches the end.

import fl.video.*;

flvPlayer.source = "videos/1.flv";

flvPlayer.addEventListener(VideoEvent.COMPLETE, completeHandler);

function completeHandler(event:VideoEvent):void
{
    MovieClip(this.root).gotoAndPlay(1, "mainScene");
}

in CS6, it gives me this compile error:

enter image description here


Solution

  • It is probably, not the problem of CS5 or CS6, but the target runtime version of flash.

    VideoEvent.COMPLETE is defined in flash 10.1 & below.

    Try using Event.COMPLETE instead of VideoEvent.COMPLETE (From this discussion)