0
我非常困惑,我花了一整天的时间去做一些应该很容易的事情。我只想从JavaScript调用Flash函数 - 就是这样。无法通过JavaScript调用Flash AS3函数
ActionScript代码:
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>
这不起作用,功能 '测试' 的对象不存在 '测试'
我想我'在这里问一个最后的努力。这里是我的活生生的例子: http://itsclassified.info/flash/Test.html
使用'document.getElementById(“Test”)'来获取对象的引用。 – BadFeelingAboutThis 2014-09-22 20:40:03