我有以下代码,它不会打印我想从 javascript 传递的值。如果有人能指出我所犯的错误,我将不胜感激。
HTML 我将 template.html 中的代码编辑如下,包括 IP=test 和 IP=192.168.11.2 如下
<param name="flashvars" value="IP=Test" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}" flashVars="IP=192.168.11.2">
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name='flashVars' value='IP=192.168.11.2'/>
我的弹性代码如下
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
layout="absolute" viewSourceURL="srcview/index.html" creationComplete="{init();}">
<mx:Script><![CDATA[
[Bindable] private var ip_string:String;
private function init():void {
ip_string = Application.application.parameters.IP;
iplabel.text = ip_string;
}
]]>
</mx:Script>
<mx:Panel id="namePanel" width="1257" height="168" layout="absolute" alpha="1" roundedBottomCorners="true" borderStyle="none" cornerRadius="4" horizontalAlign="center" verticalAlign="middle" backgroundColor="#001e2a18" horizontalCenter="-136" verticalCenter="-411" fontSize="15" backgroundAlpha="0" color="#003e1e1e" themeColor="16316412">
<mx:Label x="21" y="5" text="UBI-Collage Gallery" width="1197" height="67.95" alpha="1" styleName="MyTextStyle" fontFamily="woodcut" fontSize="60" color="#00090908" textAlign="center" fontWeight="normal"/>
<mx:Label id="iplabel" x="90" y="85" styleName="codeStyle" textAlign="center" color="#00000000" fontFamily="woodcut" fontSize="32" text="IP"/>
</mx:Panel>
</mx:Application>