2011-04-06 84 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