你如何从 Flash 触发 javascript 功能? [英] How do you trigger javascript functions from flash?

查看:23
本文介绍了你如何从 Flash 触发 javascript 功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 flash 中使用 actionscript 触发 javascript 函数?

How do you trigger a javascript function using actionscript in flash?

目标是从 Flash 电影中触发 jQuery 功能

The goal is to trigger jQuery functionality from a flash movie

推荐答案

查看外部接口-类.
来自 AS3 语言参考:

Take a look at the ExternalInterface-Class.
From the AS3-Language Reference:

ExternalInterface 类是外部 API,一个应用程序使能的编程接口之间的直接沟通ActionScript 和 Flash Player容器——例如,一个 HTML 页面使用 JavaScript.Adobe 推荐对所有人使用 ExternalInterfaceJavaScript-ActionScript 通信.

The ExternalInterface class is the External API, an application programming interface that enables straightforward communication between ActionScript and the Flash Player container– for example, an HTML page with JavaScript. Adobe recommends using ExternalInterface for all JavaScript-ActionScript communication.

它是这样工作的:

ExternalInterface.addCallback("sendToActionScript", receivedFromJavaScript);
ExternalInterface.call("sendToJavaScript", input.text);

您可以提交参数并接收回调...非常酷,对吧?;)

You can submit parameters and recieve callbacks...pretty cool, right? ;)

据我所知,它也适用于 AS2...

As I know it will also work on AS2...

这篇关于你如何从 Flash 触发 javascript 功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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