Thursday, May 01, 2008

First AIR Application : hiding the FlexChrome

Yesterday I started work on my first real AIR widget.  I've had a play around with it in the past and enjoyed what I've seen.   But it's not until you have a real project that you start  to really appreciate a new technology.  The widget  I'm building is going to need multiple windows so I spent a fair bit of time getting used to the AIR Window mechanism.  What I learned is that your life is going to be a lot easier if you can use mx:Window to create new AIR windows rather than the NativeWindow.  What I also learned is that getting rid of the Chrome in mx:Window is not as obvious as it first seemed.  The Chrome refers to the framing of the window  (i.e making it look like all the other windows the OS  creates).  It's easy enough to set the SystemChrome to none.  But that just means the window will use the FlexChrome (i.e has the features of the NativeWindow but with styles defined by Adobe).  The FlexChrome is nice but it's not suitable for our design so it has to go.  The problem is that it's not that obvious how you make the FlexChrome go away.  I finally found the answer among the mx:Window styles.  You need to set showFlexChrome to false.  The best way to do this is through CSS.  All of our windows will need custom chrome so I created a style for Window (see below) and the job was done.  It's one of those things that seems obvious now I know but that took me way to long to find.
Window
{
    showFlexChrome:false;
}

No comments: