【问题标题】:SHOW_ALL gets too big instead of scalingSHOW_ALL 变得太大而不是缩放
【发布时间】:2014-04-02 16:13:53
【问题描述】:

我想在配备 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();

                             }

感谢您的帮助!

【问题讨论】:

标签: actionscript-3 air fullscreen stage


【解决方案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;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-26
    • 2017-01-20
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 2018-08-30
    相关资源
    最近更新 更多