backgroundColor with showFlexChrome=”false”

Posted on February 5, 2009 | Comments Off

I came across a scenario that I wanted an AIR app to have a background color set while systemChrome=”true” but showFlexChrome=”false”. Here is another post describing the problem. I tried to figure out what was going on and how the green-greyish background shows up (or white background in Flex 4) but couldn’t figure out where that is created. But I did notice that when showFlexChrome=”false” that the backgroundAlpha style was set to 0. So the workaround for the problem is to set the backgroundAlpha back to 1 after the application has created it self (on creationComplete event).

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
       xmlns:mx="http://www.adobe.com/2006/mxml"
       layout="vertical"
       backgroundColor="0x0000FF"
       creationComplete="setBG()"
       showFlexChrome="false"
       >
    <mx:Script>
        <![CDATA[
            private function setBG():void
            {
                this.setStyle("backgroundAlpha", 1);
            }
        ]]>
    </mx:Script>
</mx:WindowedApplication>

Is there an easy way to do this? So the easier way of setting a background color withe showFlexChrome=”false” is to set the background color of the SWF.

Cookbook link for setting SWF background value.