所以,在我作为文件我要打电话像
So in my AS file I want to call a function like
public function JS(streamUri:String):void{
JavascriptCommand(streamUri)
}
让我的JS code运行...
to get my JS code running...
如何做这样的事情(例如需要)
How to do such thing (Example needed)
推荐答案
这听起来像你正在寻找 ExternalInterface.call()。 Adobe公司有关如何使用它从ActionScript调用JavaScript的文章。
It sounds like you're looking for ExternalInterface.call(). Adobe has an article about how to use it to call JavaScript from ActionScript.
您也可以使用ExternalInterface的揭露ActionScript来JavaScript和调用函数内部从JavaScript您的SWF。
You can also use ExternalInterface to expose ActionScript to JavaScript and call functions internal to your SWF from JavaScript.
让我们假设你有一个JavaScript函数,看起来像这样:
Let's say you have a JavaScript function that looks like this:
function specialAlert(msg) {
alert(msg);
}
从您的Flash文件,你可以这样调用它:
From your flash file you can call it like this:
import flash.external.*;
ExternalInterface.call("specialAlert", "Hi mom!");
和你的JavaScript函数应该被调用,提醒用户妈妈你好!。
And your JavaScript function should be called and alert the user "Hi mom!".
相关推荐
最新文章