听我的Flash事件在Javascript我的、事件、Flash、Javascript

2023-09-09 21:24:15 作者:痴心少年√

我试图建立一个基本的视频播放器使用的OVP播放器的播放列表。到目前为止,我已经找到了如何使用ExternalInterface的新的视频源在饲料中,但我无法弄清楚如何监听Flash事件EVENT_END_OF_ITEM。

I'm trying to build a basic video player with a playlist using the OVP Player. So far I have figured out how to feed in the new video source using ExternalInterface, but I can not figure out how to listen for the Flash event "EVENT_END_OF_ITEM".

我如何在Javascript(因此jQuery的)?监听Flash事件

How do I listen for Flash events in Javascript (and thus jQuery)?

OVP有很多定义的事件,但我不懂得去倾听他们。例如,这里是EVENT_END_OF_ITEM:

OVP has a lot of events defined, but I don't know how to listen for them. For example, here is the EVENT_END_OF_ITEM:

public function endOfItem():void {
     sendEvent(EVENT_END_OF_ITEM);
}

该OVP文档不存在和他们的支持论坛是几乎一样糟糕。

The OVP documentation is non-existent and their support forum is almost as bad.

推荐答案

在Model.as文件中找到与其他所有进口加入这一行(在文件的开始):

In the Model.as file find add this line in with all the other imports (at the start of the file):

import flash.external.*;

然后在结束事件,添加此行:

Then in the end event, add this line:

ExternalInterface.call("stopedPlaying");

这样的事件是这样的:

So that an event would look like this:

        public function endOfItem():void {
            sendEvent(EVENT_END_OF_ITEM);
            // inform JavaScript that the FLV has stopped playing
            ExternalInterface.call("stoppedPlaying");
        }

那么你的HTML文档中,脚本标记之间补充一点:

Then in your the HTML document, add this between SCRIPT tags:

function stoppedPlaying()
{
    // do something when the FLV starts playing
};