【发布时间】:2014-09-21 23:57:41
【问题描述】:
我非常困惑,我花了一整天的时间来做一些应该很容易的事情。我只想从 JavaScript 调用 Flash 函数 - 就是这样。
动作脚本代码:
import flash.display.Loader;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
import flash.external.ExternalInterface;
import flash.net.FileReference;
import flash.events.IOErrorEvent;
import flash.events.Event;
import flash.system.Security;
Security.allowDomain("*");
ExternalInterface.addCallback("test", test);
function test()
{
ExternalInterface.call("alert", "Doesn't Work");
}
JavaScript/HTML
<h1>Test</h1>
<script>
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
function poc() {
getFlashMovie( "Test" ).test();
}
</script>
<button onclick="poc()">Click Me!</button>
这不起作用,对象'Test'不存在函数'test'
我想我会在这里问作为最后的努力。这是我的现场示例: http://itsclassified.info/flash/Test.html
【问题讨论】:
-
使用
document.getElementById("Test")获取对对象的引用。
标签: javascript actionscript-3 flash