Javascript 如何获取屏幕上的可用区域

Javascript 如何获取屏幕上的可用区域,javascript,apache-flex,actionscript,Javascript,Apache Flex,Actionscript,在我的Flex应用程序中,模块的分辨率可以大于屏幕的分辨率,并且有一个垂直滚动条 当用户单击某个位置时,我会在鼠标坐标位置弹出一个小组件 但是,如果用户单击时离屏幕边缘太近,我需要防止组件出现在可视区域之外 为此,我需要知道可视区域的尺寸。我试过Capabilities.screenResolutionX和Capabilities.screenResolutionY,但它们在该区域将包括浏览器工具栏 这个.width和这个.height显然不起作用,因为模块将超过100%的高度 那么,是否有任何

在我的Flex应用程序中,模块的分辨率可以大于屏幕的分辨率,并且有一个垂直滚动条

当用户单击某个位置时,我会在鼠标坐标位置弹出一个小组件

但是,如果用户单击时离屏幕边缘太近,我需要防止组件出现在可视区域之外

为此,我需要知道可视区域的尺寸。我试过Capabilities.screenResolutionX和Capabilities.screenResolutionY,但它们在该区域将包括浏览器工具栏

这个.width和这个.height显然不起作用,因为模块将超过100%的高度


那么,是否有任何方法可以计算浏览器中的可用空间(在actionscript或javascript中)?

我在javascript和ExternalInterface中使用以下内容来检索Actionscript3中的结果

function pageWidth() { return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null; } function pageHeight() { return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;} 函数pageWidth() { return window.innerWidth!=null?window.innerWidth:document.body!=null?document.body.clientWidth:null; } 函数pageHeight() { return window.innerHeight!=null?window.innerHeight:document.body!=null?document.body.clientHeight:null;}
我在Javascript和ExternalInterface中使用以下内容来检索Actionscript3中的结果

function pageWidth() { return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null; } function pageHeight() { return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;} 函数pageWidth() { return window.innerWidth!=null?window.innerWidth:document.body!=null?document.body.clientWidth:null; } 函数pageHeight() { return window.innerHeight!=null?window.innerHeight:document.body!=null?document.body.clientHeight:null;}
stage.stageWidth和stage.stageHeight

stage.stageWidth和stage.stageHeight