I am trying to center a launched window in flex, there is a NativeWindow.x and NativeWindow.y but flex uses the Window class which does not have these properties, so does anyone know how to center a window? Thanks!!
+2
A:
I figured it out:
window.nativeWindow.x = (Screen.mainScreen.bounds.width - window.width)/2;
window.nativeWindow.y = (Screen.mainScreen.bounds.height - window.height)/2;
I think you have to call this AFTER window.open() though.
John Isaacks
2009-07-03 16:56:33
Hehe... you have answered your question.From what I know... this is the right way to do it :)
Adrian Pirvulescu
2009-07-03 17:48:10
A:
isn't this better?
example docs:
// center the window on the screen
var screenBounds:Rectangle = Screen.mainScreen.bounds;
nativeWindow.x = (screenBounds.width - nativeWindow.width) / 2;
nativeWindow.y = (screenBounds.height - nativeWindow.height) / 2;
from livedocs: about window containers ¨
both solutions worked for me even on multiple screen system (Win7)
Redliner
2009-11-25 10:46:09