2011-04-06 87 views
2

在FlashBuilder的编译器选项(属性 - > Flex编译器),为“Adobe Flash Player选项”中有对“使用特定版本”,在这里你可以告诉它的Flash播放器来链接的选项:越来越SWF版本信息

enter image description here

我如何在运行时该值?请注意,我不是在谈论Flash Player版本,而是swf所链接的版本。

+0

,以前Sean链接的问题是如何在Flash之外进行检查。我发布的内容用于检查Flash。那么适用于你的情况呢? – jhocking 2011-04-06 21:13:21

回答

1

你不能得到,准确的目标版本。您可以获取SWF文件版本,但这不相同。当您在该面板中编辑目标版本时,Flex会针对不同的playerglobal.swc进行编译,但不一定会更改SWF文件版本。

0
+0

这似乎是读取swf文件。我希望swf本身在运行时打印版本。 – paleozogt 2011-04-06 21:26:07

+0

啊,好的。是的,那对你不起作用:) – 2011-04-06 21:28:22

+1

实际上,答案可能仍然有用,尽管你会做更多的工作,超出了答案所说的。基本上,你可以让swf中的代码读取swf的二进制数据并检查它。在运行时修改二进制文件将是疯狂的谈话,但只有阅读它应该没问题。 – jhocking 2011-04-06 21:30:34

1

你有一个项目,你可以修改或者是你想生成后找到一个SWF文件的版本做这个,如果是前者,你可以修改index.template.html包括Flash变量使用建立变量作为参数然后在运行时检索这些变量

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
       layout="absolute" 
       creationComplete="application1_creationCompleteHandler(event)"> 
    <mx:Script> 
     <![CDATA[ 
      import mx.controls.Alert; 
      import mx.events.FlexEvent; 

      protected function application1_creationCompleteHandler(event:FlexEvent):void 
      { 
       // TODO Auto-generated method stub 
       Alert.show(Application.application.parameters.fpVersion); 
      } 
     ]]> 
    </mx:Script> 
</mx:Application> 

我index.template.html

<html lang="en"> 

<!-- 
Smart developers always View Source. 

This application was built using Adobe Flex, an open source framework 
for building rich Internet applications that get delivered via the 
Flash Player or to desktops via Adobe AIR. 

Learn more about Flex at http://flex.org 
// --> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

<!-- BEGIN Browser History required section --> 
<link rel="stylesheet" type="text/css" href="history/history.css" /> 
<!-- END Browser History required section --> 

<title>${title}</title> 
<script src="AC_OETags.js" language="javascript"></script> 

<!-- BEGIN Browser History required section --> 
<script src="history/history.js" language="javascript"></script> 
<!-- END Browser History required section --> 

<style> 
body { margin: 0px; overflow:hidden } 
</style> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
// ----------------------------------------------------------------------------- 
// Globals 
// Major version of Flash required 
var requiredMajorVersion = ${version_major}; 
// Minor version of Flash required 
var requiredMinorVersion = ${version_minor}; 
// Minor version of Flash required 
var requiredRevision = ${version_revision}; 
// ----------------------------------------------------------------------------- 
// --> 
</script> 
</head> 

<body scroll="no"> 
<script language="JavaScript" type="text/javascript"> 
<!-- 
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) 
var hasProductInstall = DetectFlashVer(6, 0, 65); 

// Version check based upon the values defined in globals 
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); 

if (hasProductInstall && !hasRequestedVersion) { 
    // DO NOT MODIFY THE FOLLOWING FOUR LINES 
    // Location visited after installation is complete if installation is required 
    var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; 
    var MMredirectURL = window.location; 
    document.title = document.title.slice(0, 47) + " - Flash Player Installation"; 
    var MMdoctitle = document.title; 

    AC_FL_RunContent(
     "src", "playerProductInstall", 
     "FlashVars", "MMredirectURL="+MMredirectURL+"&MMplayerType="+MMPlayerType+"&MMdoctitle="+MMdoctitle+"&fpVersion="+requiredMajorVersion+requiredMinorVersion+requiredRevision+"", 
     "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" 
    ); 
} else if (hasRequestedVersion) { 
    // if we've detected an acceptable version 
    // embed the Flash Content SWF when all tests are passed 
    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", 
      "flashVars", "&fpVersion="+requiredMajorVersion+requiredMinorVersion+requiredRevision, 
      "pluginspage", "http://www.adobe.com/go/getflashplayer" 
    ); 
    } else { // flash is too old or we can't detect the plugin 
    var alternateContent = 'Alternate HTML content should be placed here. ' 
    + 'This content requires the Adobe Flash Player. ' 
    + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; 
    document.write(alternateContent); // insert non-flash content 
    } 
// --> 
</script> 
<noscript> 
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
      id="${application}" width="${width}" height="${height}" 
      codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> 
      <param name="movie" value="${swf}.swf" /> 
      <param name="quality" value="high" /> 
      <param name="bgcolor" value="${bgcolor}" /> 
      <param name="allowScriptAccess" value="sameDomain" /> 
      <embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}" 
       width="${width}" height="${height}" name="${application}" align="middle" 
       play="true" 
       loop="false" 
       quality="high" 
       allowScriptAccess="sameDomain" 
       type="application/x-shockwave-flash" 
       pluginspage="http://www.adobe.com/go/getflashplayer"> 
      </embed> 
    </object> 
</noscript> 
</body> 
</html> 

如果这是你想做的事,你可能会想,以填补在无脚本块中的变量以及添加一些分隔符的什么版本,但我只是想看看这是否按我的预期工作,如果这是你首先要做的。

2

我们在我的公司面临着同样的问题,我们已经找到了以下映射:

"SWF Version" | "Flash Player Version" 
======================================== 
     9  |   9 
     10  |  10.0, 10.1 
     11  |   10.2 
     12  |   10.3 
     13  |   11.0 
     14  |   11.1 
     15  |   11.2 
     16  |   11.3 
     17  |   11.4 
     18  |   11.5 
     19  |   11.6 
     20  |   11.7 
     21  |   11.8 
     22  |   11.9 
     23  |   12.0 
     24  |   13.0 
     25  |   14.0 

来源:

+0

这也是一个答案http://stackoverflow.com/questions/9537076/chart-of-swf-versions-to-flash-versions – paleozogt 2012-06-05 15:19:49

+0

@paleozogt谢谢,我会复制到那里。 – 2012-06-05 16:04:14