考虑以下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
的大小,我需要知道在全屏模式下屏幕的大小。
解决给定问题的正确方法是什么?
答案 0 :(得分:1)
使用Capabilities类。
具体来说,我建议您查看screenResolutionY和screenResolutionX。
但是,您也可以考虑在updateDisplayList()中调整子元素的大小,这将始终为您提供容器的高度和宽度,我怀疑这对于筛选目的而言比屏幕分辨率更重要。