【发布时间】:2010-03-02 00:39:04
【问题描述】:
从 Flash 中的一个按钮,我只想调用一个用 jQuery 编写的函数。
当我将函数放在 jQuery 的 $(document).ready 之外时,它可以正常工作:
*顺便说一句,我使用 SWFObject 嵌入 Flash。
AS3:
import flash.external.ExternalInterface;
function test_fnc(event:Event):void {
ExternalInterface.call("jsFunction", "hello world");
}
test_mc.addEventListener("click", test_fnc);
JS:
<script type="text/javascript">
function jsFunction(words) {
alert(words); // "hello world";
}
$(document).ready(function() {
// not from here
});
</script>
【问题讨论】:
-
真的不清楚你在问什么。为什么需要在 $(document).ready 中定义一个函数?
-
我需要访问一个用 jQuery 创建的数组: var alt_array = $("#thumbnails img").map(function() { return $(this).attr("alt"); } );
标签: jquery flash actionscript-3 externalinterface document-ready