Keynote Suggestion: Add Diagramming Support | Home | Troubleshooting Presentation for IE6/7

Filed under Quick Tips on May 29, 2008 by Javier Julio

Centering an Application or Window In AIR

I've run into several AIR applications that don't center the main window on your desktop by default. This positioning is something I would prefer because I've had many AIR applications that have installed partially hidden under my OSX dock.

Originally, I came across a simple way of centering a window by doing the following on the applicationComplete event:

If you add the above block in your MXML component containing the WindowedApplication tag, you won't need to import anything for the centering to take place. However, you do need to apply it on the applicationComplete event, otherwise an error occurs on the last line.

Recently, though, I came across a sample in the Adobe Flex LiveDocs where a much shorter snippet performs the same desired functionality and works in all three events: initialize, creationComplete and applicationComplete.

Post a Comment Digg Del.icio.us

Trackback Pings (TrackBack URL for this entry)

http://www.arc90.com/cgi-bin/mt4/mt-tb.cgi/154.

Post a Comment:

Keynote Suggestion: Add Diagramming Support | Main | Troubleshooting Presentation for IE6/7