在mxml中呼叫javascript的函式主要透過ExternalInterface class, 直接看run例子吧~
main.mxml --------------------------
private function callJavaScript():void {
if(ExternalInterface.available) {
ExternalInterface.call("sayHelloWorld");
} else {
Alert.show("ExternalInterface is not available");
}
}
<mx:Button label="Say 'Hello World'" click="callJavaScript();" />
HTML document ------------------------
<script language="JavaScript" type="text/javascript">先用ExternalInterface.available確認你的flex是否支援外部介面.
function sayHelloWorld() {
alert("Hello World, from JavaScript");
}
</script>
這邊所指的html通常是編輯/html-template/下面的index.template.html
我想這樣就應該可以讓user點擊認證信中html的url, 將id和mail透過javascript傳給swf了~
沒有留言:
張貼留言