Get Current Operating System In Adobe Air

前端 未结 3 1646
甜味超标
甜味超标 2021-02-02 15:02

I\'m making an App using Adobe Flex/Air. I was wondering if there is any way to get the Operating System the Air app is running on?

相关标签:
3条回答
  • 2021-02-02 15:37

    For clarity sake, I use this code (although it does the same thing as Mudasir's)

    if(Capabilities.os.search("Windows")>=0)
         //do something
    

    Here are what the docs say:

    flash.system.Capabilities.os():String [Read Only] Specifies the current operating system. The os property can return the following strings: Operating system Value

    Windows 7
    Windows Vista
    Windows Server 2008 R2
    Windows Server 2008
    Windows Home Server
    Windows Server 2003 R2
    Windows Server 2003
    Windows Server XP 64
    Windows XP
    Windows 98
    Windows 95
    Windows NT
    Windows 2000
    Windows ME
    Windows CE
    Windows SmartPhone
    Windows PocketPC
    Windows CEPC
    Windows Mobile
    Mac OS "Mac OS X.Y.Z" (where X.Y.Z is the version number, for example: "Mac OS 10.5.2")
    Linux "Linux" (Flash Player attaches the Linux version, such as "Linux 2.6.15-1.2054_FC5smp"
    iPhone OS 4.1 "iPhone3,1"

    The server string is OS.

    Do not use Capabilities.os to determine a capability based on the operating system if a more specific capability property exists. Basing a capability on the operating system is a bad idea, since it can lead to problems if an application does not consider all potential target operating systems. Instead, use the property corresponding to the capability for which you are testing. For more information, see the Capabilities class description.

    Language Version: 3.0 Player Version: Flash 9, AIR 1.0, Lite 4

    0 讨论(0)
  • 2021-02-02 15:46
    if((Capabilities.os.indexOf("Windows") >= 0))
    {
         // in windows
    }
    else if((Capabilities.os.indexOf("Mac") >= 0))
    {
    // in mac
     } 
     else if((Capabilities.os.indexOf("Linux") >= 0))
     {
    // in linux
     }
    
    0 讨论(0)
  • 2021-02-02 15:55

    Use Capabilities class:

    import flash.system.Capabilities;
    
    trace(Capabilities.os);
    
    0 讨论(0)
提交回复
热议问题