Avg. Rating 4.1
Tags:



Problem

How do you change the background color of the Flex application during the preloader stage.

Solution

The background color that displays during the preloader phase is defined in the object embed tag of the HTML.

Detailed explanation

To accomplish change the default background of the Flash application during the preloader phase the HTML code needs to be changed.  This can be done through two methods.  The first method is to use the -default-background-color argument of mxmlc. 

In Flex Builder:

  1. Open/Create Flex Project
  2. Select Project > Properties > Flex Compiler
  3. Add -default-background-color #336699 to the "Additional compiler arguments:"

The second method is to manually set the bgcolor of the embed object tag in the HTML wrapper of the Flex application.  For example

      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
            id="test" width="100" height="100"
            codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
            <param name="movie" value="test.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#336699" />
            <param name="allowScriptAccess" value="sameDomain" />
            <embed src="test.swf" quality="high" bgcolor="#336699"
                width="100" height="100" name="test" align="middle"
                play="true"
                loop="false"
                quality="high"
                allowScriptAccess="sameDomain"
                type="application/x-shockwave-flash"
                pluginspage="http://www.adobe.com/go/getflashplayer">
            </embed>
    </object>


Report abuse

Related recipes