來源:互聯網網民 2008-09-09 07:29:15
評論這裏用了兩種方法,getURL(」javascript:函數名」)和ExternalInterface,ExternalInterface更穩定一些。
AS代碼:
on (release) {
getURL(」javascript:say(』我是Flash中的文字,用getURL方法』)」);
}
或
on (release) {
import flash.external.ExternalInterface;
ExternalInterface.call(」say」,」我是Flash中的文字,用ExternalInterface方法」);
}
HTML代碼:
<!doctype html public 「-//w3c//dtd html 4.0 transitional//en」>
<html>
<head>
<title> new document </title>
<meta name=」generator」 content=」editplus」>
<meta name=」author」 content=」">
<meta name=」keywords」 content=」">
<meta name=」description」 content=」">
<script language=」javascript」>
<!–
function say(word) {
document.getElementById(」word」).innerHTML = word
}
window.onload = function() {
say(』html』)
}
//–>
</script>
</head>
<body>
<object classid=」clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=」http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0」
id=」swf」
width=」250″
height=」150″
title=」AsJsCall」
>
<param name=」movie」 value=」js.swf」 />
<param name=」quality」 value=」high」 />
<embed src=」js.swf」 quality=」high」 pluginspage=」http://www.macromedia.com/go/getflashplayer」 type=」application/x-shockwave-flash」 width=」250″ height=」150″></embed>
</object>
Flash say: <span id=」word」 style=」color:red」></span>
</body>
</html>
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
這裏用了兩種方法,getURL(」javascript:函數名」)和ExternalInterface,ExternalInterface更穩定一些。
AS代碼:
on (release) {
getURL(」javascript:say(』我是Flash中的文字,用getURL方法』)」);
}
或
on (release) {
import flash.external.ExternalInterface;
ExternalInterface.call(」say」,」我是Flash中的文字,用ExternalInterface方法」);
}
HTML代碼:
<!doctype html public 「-//w3c//dtd html 4.0 transitional//en」>
<html>
<head>
<title> new document </title>
<meta name=」generator」 content=」editplus」>
<meta name=」author」 content=」">
<meta name=」keywords」 content=」">
<meta name=」description」 content=」">
<script language=」javascript」>
<!–
function say(word) {
document.getElementById(」word」).innerHTML = word
}
window.onload = function() {
say(』html』)
}
//–>
</script>
</head>
<body>
<object classid=」clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=」http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0」
id=」swf」
width=」250″
height=」150″
title=」AsJsCall」
>
<param name=」movie」 value=」js.swf」 />
<param name=」quality」 value=」high」 />
<embed src=」js.swf」 quality=」high」 pluginspage=」http://www.macromedia.com/go/getflashplayer」 type=」application/x-shockwave-flash」 width=」250″ height=」150″></embed>
</object>
Flash say: <span id=」word」 style=」color:red」></span>
</body>
</html>