flex使用外部参数详细版

网上的大部分文章都是一般写给自己看的
今天我把flex使用外部参数说详细点
从头说起
我们假设新建一个工程叫test 然后 在编译完后bin目录下有一个test.html文件 我们可以从这里开始打开我们编译完的test程序
这个test.html从哪里来的呢?

看test工程的根目录下有一个html-template目录 里面有一个index.template.html 这就是test.html的原身了

打开看看 看重点片断

 1  if  ( hasProductInstall  &&   ! hasRequestedVersion ) {
 2       //  DO NOT MODIFY THE FOLLOWING FOUR LINES
 3       //  Location visited after installation is complete if installation is required
 4      var MMPlayerType  =  (isIE  ==   true ?   " ActiveX "  :  " PlugIn " ;
 5      var MMredirectURL  =  window.location;
 6      document.title  =  document.title.slice( 0 47 +   "  - Flash Player Installation " ;
 7      var MMdoctitle  =  document.title;
 8 
 9      AC_FL_RunContent(
10           " src " " playerProductInstall " ,
11           " FlashVars " " MMredirectURL= " + MMredirectURL + ' &MMplayerType= ' + MMPlayerType + ' &MMdoctitle= ' + MMdoctitle + "" ,
12           " width " " ${width} " ,
13           " height " " ${height} " ,
14           " align " " middle " ,
15           " id " " ${application} " ,
16           " quality " " high " ,
17           " bgcolor " " ${bgcolor} " ,
18           " name " " ${application} " ,
19           " allowScriptAccess " , " sameDomain " ,
20           " type " " application/x-shockwave-flash " ,
21           " pluginspage " " http://www.adobe.com/go/getflashplayer "
22      );
23  else   if  (hasRequestedVersion) {
24       //  if we've detected an acceptable version
25       //  embed the Flash Content SWF when all tests are passed
26      AC_FL_RunContent(
27               " src " " ${swf} " ,
28               " width " " ${width} " ,
29               " height " " ${height} " ,
30               " align " " middle " ,
31               " id " " ${application} " ,
32               " quality " " high " ,
33               " bgcolor " " ${bgcolor} " ,
34               " name " " ${application} " ,
35               " allowScriptAccess " , " sameDomain " ,
36               " type " " application/x-shockwave-flash " ,
37               " pluginspage " " http://www.adobe.com/go/getflashplayer "
38      );
39    }  else  {   //  flash is too old or we can't detect the plugin
40      var alternateContent  =   ' Alternate HTML content should be placed here.  '
41         +   ' This content requires the Adobe Flash Player.  '
42          +   ' <a href=http://www.adobe.com/go/getflash/>Get Flash</a> ' ;
43      document.write(alternateContent);   //  insert non-flash content
44    }
45  //  -->
46  </ script >
47  < noscript >
48         < object classid = " clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 "
49              id = " ${application} "  width = " ${width} "  height = " ${height} "
50              codebase = " http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab " >
51               < param name = " movie "  value = " ${swf}.swf "   />
52               < param name = " quality "  value = " high "   />
53               < param name = " bgcolor "  value = " ${bgcolor} "   />
54               < param name = " allowScriptAccess "  value = " sameDomain "   />
55               < embed src = " ${swf}.swf "  quality = " high "  bgcolor = " ${bgcolor} "
56                  width = " ${width} "  height = " ${height} "  name = " ${application} "  align = " middle "
57                  play = " true "
58                  loop = " false "
59                  quality = " high "
60                  allowScriptAccess = " sameDomain "
61                  type = " application/x-shockwave-flash "
62                  pluginspage = " http://www.adobe.com/go/getflashplayer " >
63               </ embed >
64       </ object >
65  </ noscript >


if ( hasProductInstall && !hasRequestedVersion )  这里的意思是 在用产品安装 但是版本不对
else
  AC_FL_RunContent(
   "src", "${swf}",
   "width", "${width}",
   "height", "${height}",
   "align", "middle",
   "id", "${application}",
   "quality", "high",
   "bgcolor", "${bgcolor}",
   "name", "${application}",
   "allowScriptAccess","sameDomain",
   "type", "application/x-shockwave-flash",
   "pluginspage", http://www.adobe.com/go/getflashplayer,
   "flashvars","FileName=1.txt"
     //这里需要注意到是 如果上面段中已经有flashvars的话 直接把这个串加载它们里面如
      "FlashVars", "FileName=1.txt&MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
 );


好了 看到这里了
我们说说如果添加外部参数
使用外部参数 就在<param>

<param name="flashvars" value="FileName=1.txt" />
这段话加在哪里很重要 如果是用在flexbuilder生成的html中  则加在
index.template.html 中的 看上面的红色大字体 这里 一般就可以了 千万不要加到 最下面的
<noscript>
   <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
段中
因为不会起作用 会让你浪费很多时间

如果是你自己的网页中添加flash元素一般l 看下面红字 就好了
<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="866" height="506">
              <param name="movie" value="AlimamaCut.swf" />
              <param name="quality" value="high" />
       <param name="allowScriptAccess" value="sameDomain" />
       <param name="flashvars" value="FileName=1.txt"/> 
              <embed src="AlimamaCut.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="866" height="506" allowScriptAccess="sameDomain">
</embed>
            </object></td>


flex中如何使用外部参数 则
var str:string = Application.application.parameters.FileName;
注意 Application.application.parameters. 后面不会自动提示的 你只要
<param name="flashvars" value="FileName=1.txt"/>    里面的 写就可以了(看绿色字)

<param name="flashvars" value="FileName=1.txt&???=???"/> 也可以多个这么写 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值