import flash.external.* Flash与JS交互
import flash.external.*;
var str:String =new String(); //定义一个变量
ExternalInterface.call("GetID(ShowFlash)"); //向JS的GetID方法发送调用请求 注意:ShowFlash是页面flash的ID不是flash的名字
//flash中按钮的单击 _root.str 主场景的str变量 注意:str写在主场景中要加_root
on (release) {
getURL("mywin"+_root.str+_root.str1+".html");
}
//向str赋值为22
<script>
function GetID(flashID)
{
flashID.SetVariable("_root.str",22);
}
</script>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="784" height="410" id="ShowFlash">
<param name="movie" value="yindao.swf"> //ID与这个名字并不一样
<param name="quality" value="high">
<embed src="yindao.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-
flash" width="784" height="410">
</embed>
</object>