Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to know the device capabilities using as3 using flex

    • 0
    • 2
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 881
    Comment on it

    Capabilites of a device can be known by using Capabilities class.

    1.Capabilities class is used to determine in which environment swf is running.

    2.By using Capabilities class we can know the resolution of the users system, language of the users operating system,check the player type etc.

    Some properties of Capabilities class are:

    1.Capabilities.screenResolutionX: It specify the maximum Horizontal Resolution of screen

    2.Capabilities.screenResolutionY: It specify the maximum vertical Resolution of screen

    3.Capabiliteis.os : It speicfy the current operating system

    4.Capabiliteis.screenDPI: It specify the dot per inch resolution of the screen.

    5.Capabiliteis.cpuArchitecture: It specify the current cpu architecture.

    By using the properties in capabilities class the application can customize to give best performance on a specific device.

    Example: Small application in flex to determine the the device capabilities:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" minHeight="1024" minWidth="768" applicationDPI="320">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
    
    
                private function showInfoDevice():void {
    
                    text1.text = Capabilities.screenDPI+"screendpi";  //for screendpi
                    text2.text = Capabilities.screenResolutionX+"resolutionx"; for horizontal resolution
                    text3.text = Capabilities.screenResolutionY+"resolutiony"; for verical resolution
                    text4.text =Capabilities.os+"os";  
                    text5.text =Capabilities.cpuArchitecture+"cpuArchitecture"; 
    
                }
    
    
            ]]>
        </fx:Script>
        <s:layout>
            <s:VerticalLayout/></s:layout> //using vertical layout
    
            <s:Button id="myButton" label="click" click="showInfoDevice()"/>
    
            <s:TextArea id="text1" width="100%"/>
        <s:TextArea id="text2" width="100%"/>
        <s:TextArea id="text3" width="100%"/>
        <s:TextArea id="text4" width="100%"/>
        <s:TextArea id="text5" width="100%"/>
    
    </s:Application>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: