听我的Flash事件在Javascript [英] Listen for my Flash event in Javascript

查看:254
本文介绍了听我的Flash事件在Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个基本的视频播放器使用的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
};

这篇关于听我的Flash事件在Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆