简体   繁体   English

在Adobe AIR Windows应用程序中调整舞台大小

[英]resize stage in Adobe AIR windows application

I'm realizing an app that runs on a single display in HD and in another setup on two screens. 我正在实现一个应用程序,该应用程序可以在高清显示器上运行,并可以在两个屏幕上运行。 I'm using the none flag to make windows without borders. 我正在使用none标志来制作无边框的窗口。

Ok, how can I change my fla size after loading the my settings, in authoring the stage size is 3840x1080. 好的,在创建舞台大小为3840x1080时,如何在加载设置后更改fla大小。 how can I get 1920 width? 如何获得1920宽度?

When using AIR, you can control this via the NativeWindow.bounds property. 使用AIR时,可以通过NativeWindow.bounds属性进行控制。 You may need to add an event listener to the stage so that you don't access its window before activation (ie stage.addEventListener(Event.ACTIVATE, onActivate); ) and then add the following: 您可能需要在舞台上添加一个事件侦听器,以便在激活之前不访问其窗口(即stage.addEventListener(Event.ACTIVATE, onActivate); ),然后添加以下内容:

stage.nativeWindow.bounds = new Rectangle(0, 0, 1920, 1080);
[or]
NativeApplication.nativeApplication.activeWindow.bounds = new Rectangle(0, 0, 1920, 1080);

Note that if you do have any system chrome, there will be a difference between the stage size and the window size: you can always take the existing values and do some quick maths to work out how much space is used by the titlebar/borders and adjust your new rectangle appropriately. 请注意,如果您有任何系统镶边,则舞台大小和窗口大小之间会有所不同:您始终可以获取现有值并进行一些快速数学运算,以计算出标题栏/边框和适当调整您的新矩形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM