开发者

Determining when Video has ended in Adobe Flex using Events

开发者 https://www.devze.com 2022-12-23 22:51 出处:网络
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 thr

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.


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消