Created
December 26, 2012 09:07
-
-
Save Barneybook/4379033 to your computer and use it in GitHub Desktop.
AS呼叫JS做法
---- http://tw.myblog.yahoo.com/neo-hsu/article?mid=832
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
於AS3中呼叫JS函數並傳遞參數方法 ExternalInterface.call( ); | |
1、AS3部分,Code範例為按鈕事件觸發後呼叫JS函數jstest | |
var $jsvalue="test"; //宣告變數$jsvalue,變數值為test | |
this.addEventListener(MouseEvent.CLICK,clicktrue); //按鈕偵聽器 | |
function clicktrue(me:MouseEvent){ | |
ExternalInterface.call("jstest",$jsvalue); //jstest為欲呼叫之JS函數,$jsvalue為AS3欲傳遞到JS的參數值。 | |
} | |
2、JS部分,Code範例為Flash按鈕事件觸發後JS接收AS3所傳遞過來的參數$jsvalue | |
<script language="javascript"> | |
function jstest($jsvalue){ | |
document.write($jsvalue); //輸出結果為AS3中傳遞變數直"test"; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment