views:

616

answers:

4

I am trying to set the background color of a Flex actionscript 3 project. I have tried all sorts of things, including

this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FF0000">

</mx:Application>

this:

SWF(backgroundColor='0x000000', frameRate='30')

and this:

[SWF(backgroundColor='#000000', frameRate='30')]

What am I doing wrong? Is there something that is overriding my ability to set this? I am putting the above lines in my main default runner.

thanks

A: 

The first seems to work correctly for me.

Jon.Stromer.Galley
Hmm.... Is there anything else I can check in Flex?Where might this other color be coming from?I checked in my main .html file that is generated after cleaning and building, and I see: "bgcolor", "#869ca7",and <param name="bgcolor" value="#869ca7" />
jml
did you modify html-template file?
Amarghosh
yes i did.i think the problem was that i was making the call before my import directives. :(i put it after my import directives (thanks to a friend of mine), and now it works fine.thanks for the suggestion tho.
jml
A: 

see below. i had typed this in earlier, but should have commented.

jml
A: 

Here's one way to do it:

  1. Right click on project -> Properties -> Flex Compiler
  2. Add the following into "Additional compiler arguments:"

    -default-background-color #FFFFFF

  3. Set backgroundAlpha style property of your application to 0:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundAlpha="0">
 
</mx:Application>
Emanuil
ah; that's excellent.thanks!
jml
A: 

How do you do this dynamically in actionscript?

Andrew Bruce
found it... Application.application.setStyle( "backgroundColor", '0xffffff' );
Andrew Bruce