嘿,所以我开发使用动作脚本(土坯空单),因为我瑞士法郎的应用程序的屏幕尺寸为appox 840X480一个Android应用程序......我能察觉的Android设备的屏幕大小在运行时运行的应用程序和设置相应的屏幕尺寸?如果是的话如何? P.S - 我还是菜鸟的动作脚本 谢谢
Hey so i am developing an android application using action script(the adobe air one) since the screen size of my .swf application is appox 840X480... Can i detect the screen size of the android device running application at runtime and set the screen size accordingly?? if so How?? P.S - I'm still rookie at Action-script Thank You
基本上,使您的应用程序的液体(或响应)。请按照下列步骤:
Basically, to make your app liquid (or responsive). Follow the following steps:
设置舞台对齐和缩放模式:
Set the stage align and scale modes:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
监听在舞台上调整大小事件:
Listen for resize events on the stage:
stage.addEventListener(Event.RESIZE, stageResizeHandler);
function stageResizeHandler(e:Event):void {
stage.stageWidth; //how big the width is
stage.stageHeight; //how big the height is.
//so if you had a box, and you wanted it centered on the screen:
box.x = (stage.stageWidth - box.width) * .5;
box.y = (stage.stageHeight - box.height) * .5;
//draw a background
graphics.clear();
graphics.beginFill(0xFF0000);
graphics.drawRect(0,0,stage.stageWidth, stage.stageHeight);
graphics.endFill();
}
如果,你只是想知道显示器的物理尺寸,你可以在能力做到这一点
类:
If, you just want to know the physical size of the display, you can do so in the Capabilities
class:
Capabilities.screenResolutionX;
Capabilities.screenResolutionY;
或
stage.fullScreenWidth;
stage.fullScreenHeight;
这通常不包括任何虽然工具栏/通知栏。
This usually doesn't include any tool bars /notification bars though.
如果你只是想你的内容比例,然后设置缩放模式,以任何你想:
If you just want your content scaled, then set the scale mode to whatever you'd like:
stage.scaleMode = StageScaleMode.NO_BORDER;
//this will zoom in your app until it fills the whole screen, though it may crop it a bit if needed.
要看到其他缩放模式,看here
To see other scaling modes, look here