惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

博客园 - aixia

好久不更新了 Flex图片过度增强版 Flex加载图片的常用的几种方式 - aixia - 博客园 组件Event新写法 - aixia - 博客园 遍历flex和flash对象的属性和方法 as3访问对象属性和方法的经典用法 - aixia - 博客园 一个蛮有用的event BitmapData中不明白的问题 Array为什么这样会有错? - aixia - 博客园 flex图片过度 AS3图片特效 自定义ToolTip flex采集证券数据 flash cs3 安装程序数据库损坏无法安装的解决方法 run-time debugger for adobe flex components DataGrid通过webService和数据库绑定 给DateField和DateChooser进行汉化 flex module不编译的问题 自定义组件继承自定义组件
flex使用外部参数详细版
aixia · 2007-11-22 · via 博客园 - aixia

网上的大部分文章都是一般写给自己看的
今天我把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(047+ " - 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&???=???"/> 也可以多个这么写