views:

8

answers:

1

Hi everyone,

I'm new to Flex, Flash, and ActionScript. I'm attempting to create a video player that starts another video when the previous video ends. I thought there might be an event that is thrown when the video finishes playing, but I have not been able to find it.

VideoEvent.COMPLETE is when the video is completely downloaded, not when it is completely done playing. Does such an event exist? If not, any idea how I could subclass SWFLoader, Image, or Video to support such an event?

Thanks.

A: 

The key is to use VideoDisplay (which works a Canvas).

<mx:Script>
....
    override protected function createChildren() : void {
        super.createChildren();
        ...
        canvas = new Canvas();
        videoDisplay = new VideoDisplay();
        ...
        videoDisplay.addEventListener(VideoEvent.STATE_CHANGE, adCompleteListener);
        canvas.addChild(videoDisplay);
        this.addChild(canvas);

    }

    private function adCompleteListener(event:VideoEvent) : void {
        if (event.state == VideoEvent.STOPPED)
            // ... do whatever
    }
 ....
</mx:Script>
Brian

related questions