Positioning Flex/AIR Desktop App Window to the bottom right corner

二次信任 提交于 2019-12-06 10:42:48

问题


Any clues how this can be achieved? It needs to work on all resolutions .. is there any parent/stage object available to find out the resolution of the system?


回答1:


public function init():void
{
    nativeWindow.x = ( Screen.mainScreen.bounds.width - 300 ) 
    nativeWindow.y = ( Screen.mainScreen.bounds.height - 65 )               
}

This is a 300x65 window positioned in the bottom right. You are looking for Screen.




回答2:


Screen.mainScreen.visibleBounds takes the taskbar into account




回答3:


Another option is to create a transparent window, then maximise it, then position your window inside the transparent one, using standard bottom=0 right=0 properties.

The advantage is that maximise will take into account the windows task bar height, which could change depending on the users set up.

The disadvantage, is that the transparent window will look really ugly on systems that don't support transparency (some Linux builds).

I am also not sure how this works on OSX, you could integrate with Growl, or if on OSX do the window in a different way (DIY Growl).




回答4:


To position to the center:

        nativeWindow.x = ( Screen.mainScreen.bounds.width / 2 - nativeWindow.width / 2);
        nativeWindow.y = ( Screen.mainScreen.bounds.height / 2 - nativeWindow.height / 2);


来源:https://stackoverflow.com/questions/1291804/positioning-flex-air-desktop-app-window-to-the-bottom-right-corner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!