我試圖通過修改Flash CS5發佈的標準HTML來將flashvars讀入我的Flash文件。以下是不工作:我的flash代碼有什麼問題?
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>flashVarsTests</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: #ffffff;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
</head>
<body>
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="flashVarsTests" align="middle">
<param name="movie" value="flashVarsTests.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="flashvars" value="message1=HelloWorld&message2=HeyGuy" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="flashVarsTests.swf" width="550" height="400">
<param name="movie" value="flashVarsTests.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="flashvars" value="message1=HelloWorld&message2=HeyGuy" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
的ActionScript:
this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(myEvent:Event)
{
var flashVars=this.loaderInfo.parameters;
var msg1:String=flashVars.message1;
var msg2:String=flashVars.message2;
text1.text=msg1;
text2.text=msg2;
}
Thanks-
我希望我可以多次投票!直到我將文本控件恢復爲TLF的經典效果之前,沒有任何工作。謝謝。 – Eirinn 2013-05-16 08:33:00