下面的是页面
我想获取url的参数赋值给FlashVars<HTML lang=zh-CN xml:lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>test</TITLE>
<META content="" name=description>
<META content="" name=keywords>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<script language=javascript>
var hrefstr,pos,parastr;
hrefstr = window.location.href;
pos = hrefstr.indexOf("?");
parastr = hrefstr.substring(pos+1);
//alert(parastr);
document.write("所有参数:"+parastr);flash_test.SetVariable(FlashVars,"page=2");</script>
</HEAD>
<BODY style="MARGIN: 0px" bgColor=#ffffff scrolling="auto">
<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="1024" height="768" id="flash_test">
<PARAM NAME="_cx" VALUE="5080">
<PARAM NAME="_cy" VALUE="5080">
<PARAM NAME="FlashVars" VALUE="">
<PARAM NAME="Movie" VALUE="zcommain.swf">
<PARAM NAME="Src" VALUE="zcommain.swf">
<PARAM NAME="WMode" VALUE="Window">
<PARAM NAME="Play" VALUE="-1">
<PARAM NAME="Loop" VALUE="0">
<PARAM NAME="Quality" VALUE="High">
<PARAM NAME="SAlign" VALUE="">
<PARAM NAME="Menu" VALUE="0">
<PARAM NAME="Base" VALUE="">
<PARAM NAME="AllowScriptAccess" VALUE="sameDomain">
<PARAM NAME="Scale" VALUE="NoScale">
<PARAM NAME="DeviceFont" VALUE="0">
<PARAM NAME="EmbedMovie" VALUE="0">
<PARAM NAME="BGColor" VALUE="FFFFFF">
<PARAM NAME="SWRemote" VALUE="">
<PARAM NAME="MovieData" VALUE="">
<PARAM NAME="SeamlessTabbing" VALUE="1">
<PARAM NAME="Profile" VALUE="0">
<PARAM NAME="ProfileAddress" VALUE="">
<PARAM NAME="ProfilePort" VALUE="0">
<PARAM NAME="AllowNetworking" VALUE="all">
<PARAM NAME="AllowFullScreen" VALUE="true">
<embed src="zcommain.swf" FlashVars="" width="100%" height="100%" loop="true"  align="middle" id="flash_test" menu="false" quality="high" bgcolor="#ffffff" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" scale="noscale"  />
</OBJECT>
</BODY>
</HTML>

解决方案 »

  1.   

    flash_test.SetVariable("page","2"); 
      

  2.   

    不行啊,js提示flash_test未定义
      

  3.   

    Js和As是可以相互调用的。
    在As里边提供调用函数 给 Js 调用,传参数还是执行点别的都可以。Flash里边的关键代码:
    ExternalInterface.addCallback("flashOut",OutMsg);//外部调用声明
    public function OutMsg(msg:String):String {
    text.appendText(msg+"\n");
    return msg;
    }Js里边调用:var flashObj = document.getElementById("Flash对象的ID");
    flashObj.flashOut(msg);
    注意:Flash As是3.0版本。