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