我想在带有Retina显示屏的Macbook Pro上运行带有AIR的双屏幕应用程序。
在我的左侧屏幕(视网膜)上有一种控制台,您可以通过它选择一部电影,在右侧屏幕上播放所选的电影。
通常,我使用StageScaleMode.SHOW_ALL将它很好地带到全屏。但这一次,它变得太大了。也许100倍太大了。我只看到电影的左上角。如果我选择StageScaleMode.NO_SCALE;
,它只显示正确的大小有人猜到为什么会这样吗?
这是代码的一部分,我在其中调出两个窗口并尝试全屏显示。
public function setToFullscreen(e:Event):void {
startTimer.stop();
startTimer.removeEventListener("timer", setToFullscreen);
windowBig = new NativeWindow(new NativeWindowInitOptions());
windowBig.width = 1870;
windowBig.height = 468;
windowBig.stage.displayState = StageDisplayState.FULL_SCREEN;
windowBig.stage.scaleMode = StageScaleMode.SHOW_ALL;
windowBig.stage.align = StageAlign.TOP_LEFT;
windowBig.title = "Second Screen Window";
windowSmall = stage.nativeWindow;
windowSmall.width = 1280;
windowSmall.height = 1024;
windowSmall.stage.scaleMode = StageScaleMode.NO_SCALE;
windowSmall.stage.align = StageAlign.TOP_LEFT;
windowSmall.title = "First Screen Window";
ScreenManager.openWindowFullScreenOn(windowBig,2);
loader.load();
}
感谢您的帮助!
答案 0 :(得分:1)
就像OP说的那样,SHOW_ALL不可能自动完成,但是你可以手动完成(这里它不像SHOW_ALL那样:我只是将内容与窗口高度拟合,所以它适用于窗口纵横比等于或宽于内容比率,否则内容将被裁剪):
newWindow.addEventListener(Event.RESIZE, onResize);
function onResize(e:Event):void
{
content.height = newWindow.stage.stageHeight; // fit to height
content.scaleX = content.scaleY; // keep width ratio
// Extra: equivalent of StageAlign.TOP => centers horizontally
// (assuming a content registration point at top-left)
var contentRatio = 4/3; // in case content is wider than necessary, e.g. wide background
content.x = newWindow.stage.stageWidth/2 - (content.height * contentRatio )/2;
}