2008-09-23 72 views

回答

8

如果您在IDE中以下程序將讓你的版本

 
trace(Capabilities.version); 

如果你正在建設一個自定義類以下應該有所幫助。 確保此下面的代碼進入一個名爲VersionCheck.as

 
package 
{ 
    import flash.system.Capabilities; 

    public class VersionCheck 
    { 
     public function VersionCheck():void 
     { 
      trace(Capabilities.version); 
     } 
    } 
} 

希望這有助於文件,永遠記住,所有的AS3語言可以在網上點擊這裏http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/進行研究。

+0

Grase ansewr Brian,非常感謝,這可以幫助我很多! – 2008-09-24 14:51:25

4

這個例子可能有助於確定您收到的詳細信息,以便您可以根據所獲得的有點尷尬的數據採取行動。

import flash.system.Capabilities; 


var versionNumber:String = Capabilities.version; 
trace("versionNumber: "+versionNumber); 
trace("-----"); 

// The version number is a list of items divided by "," 
var versionArray:Array = versionNumber.split(","); 
var length:Number = versionArray.length; 
for(var i:Number = 0; i < length; i++) trace("versionArray["+i+"]: "+versionArray[i]); 
trace("-----"); 

// The main version contains the OS type too so we split it in two 
// and we'll have the OS type and the major version number separately. 
var platformAndVersion:Array = versionArray[0].split(" "); 
for(var j:Number = 0; j < 2; j++) trace("platformAndVersion["+j+"]: "+platformAndVersion[j]); 
trace("-----"); 

var majorVersion:Number = parseInt(platformAndVersion[1]); 
var minorVersion:Number = parseInt(versionArray[1]); 
var buildNumber:Number = parseInt(versionArray[2]); 

trace("Platform: "+platformAndVersion[0]); 
trace("Major version: "+majorVersion); 
trace("Minor version: "+minorVersion); 
trace("Build number: "+buildNumber); 
trace("-----"); 

if (majorVersion < 9) trace("Your Flash Player version is older than the current version 9, please update."); 
else trace("You are using Flash Player 9 or later."); 
+0

感謝您的解釋。沒有必要,但有幫助 – 2008-09-29 16:50:29