ActionScript 3的调用javascript函数函数、ActionScript、javascript

2023-09-09 21:45:43 作者:时光偷走初心

是它可以调用内部的闪存(AS3)JavaScript函数?如何不在同一个域?你能提供一个例子代码片段和导航特殊不相同的域?

is it possible to call javascript functions inside flash (as3)? How about not in the same domain? Can you provide an example snippet for samedomain and not same domain?

谢谢!

推荐答案

使用,你可以用JavaScript从Flash但只有在窗口,Flash应用程序正在运行通信,ExternalInterface的。

Using the ExternalInterface you can communicate with JavaScript from Flash, however only in the window where the Flash application is running.

这是那么容易,因为这样做的:

It is as easy as doing:

ExternalInterface.call("jsFunctionName", argument, argument, ...);

要反过来做(呼叫闪光从JavaScript),你做以下第一:

To do the reverse (calling Flash from JavaScript) you do the following first:

ExternalInterface.addCallback("jsFunctionName", callbackFunction);

function callbackFunction(arg:String):void {
    trace(arg);
}

然后就可以调用 jsFunctionName(富)从JavaScript。

And then you can call jsFunctionName("foo") from JavaScript.

请参见的Adobe文档上的更多信息。

至于你的跨域,你不能就我知道,但你可能能够代理呼叫通过你的服务器。

As for your cross domain, you can't as far as I know, but you may be able to proxy the call via your server.