Adobe air mobile size in percent

I want to create adobe air mobile app for Android and iOS, application is not game and I will use only vectors for GUI. Does it make sense to calculate the size of the objects and text size in percentage for multi screen?

Example header will be height 10%(10% percent convert to pixels) of stage height and width 100%, all objects inside header will be calculated in percent too in relative size to header.

Button in header will be 70% height of header height and so on...


I believe this is the safe and faster way (I use this way). But you can put the hardcoded values and multiply the device width divided by the stage width too.

    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;

    //before set the stage to "fullscreen"
    var ratio:Number = Capabilities.screenResolutionX/stage.stageWidth;

    //resing the stage to the screenResolution
    stage.stageWidth = Capabilities.screenResolutionX;
    stage.stageHeight = Capabilities.screenResolutionY;

    //
    myObject.width = 45 * ratio;
    myObject.height = 50 * ratio;
链接地址: http://www.djcxy.com/p/34606.html

上一篇: Flex 4:项目渲染器和命名对象的设置值(奇怪Bug)

下一篇: Adobe空气移动大小以百分比表示