Archive for February 5th, 2009

backgroundColor with showFlexChrome=”false”

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:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:WindowedApplication
  3.         xmlns:mx="http://www.adobe.com/2006/mxml"
  4.         layout="vertical"
  5.         backgroundColor="0x0000FF"
  6.         creationComplete="setBG()"
  7.         showFlexChrome="false"
  8.        >
  9.     <mx:Script>
  10.         <![CDATA[
  11.             private function setBG():void
  12.             {
  13.                 this.setStyle("backgroundAlpha", 1);
  14.             }
  15.         ]]>
  16.     </mx:Script>
  17. </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.

Add comment February 5th, 2009



About: I work as a Platform Evangelist for Adobe Systems Incorporated.

My Amazon.com Wish List

Calendar

February 2009
S M T W T F S
« Dec   Apr »
1234567
891011121314
15161718192021
22232425262728

Posts by Month

Posts by Category


Flex.org - The Directory for Flex