在Flex中进入全屏模式时调整对象大小

时间:2010-12-07 14:23:14

标签: flex flash actionscript-3

考虑以下Flex代码:

private function fullScreenHandler(evt:FullScreenEvent):void {
  if (evt.fullScreen) {
    viewstack.selectedIndex = 2;
    objectInViewStack2.width = [code to detect width when in full screen mode];
    objectInViewStack2.height = [code to detect height when in full screen mode];
  } else {
     viewstack.selectedIndex = 1;
  }
}

我有一个包含两个画布的视图堆栈。在正常模式下使用画布1,在全屏模式下使用画布2。

要正确调整objectInViewStack2的大小,我需要知道在全屏模式下屏幕的大小。

解决给定问题的正确方法是什么?

1 个答案:

答案 0 :(得分:1)

使用Capabilities类。

具体来说,我建议您查看screenResolutionYscreenResolutionX

但是,您也可以考虑在updateDisplayList()中调整子元素的大小,这将始终为您提供容器的高度和宽度,我怀疑这对于筛选目的而言比屏幕分辨率更重要。