Link to home
Start Free TrialLog in
Avatar of marcparillo
marcparillo

asked on

Setting CSS style for WindowedApplication in external stylesheet

Hello,

I'm getting warnings in an mxml file for an application I'm building and I don't know why.  

I would like the user to be able to change the background color of the application, so I moved the backgroundColor setting of the <s:Window/> and <s:WindowedApplication/> tags from within the tag themselves to the external stylesheet, like this:

External stylesheet
------------------------
/* CSS file */
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";

s|WindowedApplication {
      backgroundColor: #222222;      
}
s|Window {
      backgroundColor: #222222;      
}

So, when the user wants to change the background color, I just load up a new stylesheet containing the selected background color settings.  This actually works when I test the app, but Flash Builder is also showing me the following warning: "CSS type selectors are not supported in components: 'spark.components.WindowedApplication'."

That warning doesn't make sense to me because, as far as I understand, you can set CSS styles for such things as the WindowedApplication and Window.   The options (s|WindowedApplication and s|Window) are actually in the options for CSS styles.

What gives?

Thanks,
marc



Avatar of dgofman
dgofman
Flag of United States of America image

Interesting I don't see such warnings using SDK 4.1.0

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                 xmlns:s="library://ns.adobe.com/flex/spark"
                                 xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init()">
      <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";

            s|WindowedApplication {
                  backgroundColor: #222222;      
            }
            s|Window {
                  backgroundColor: #222222;      
            }
      </fx:Style>
</s:WindowedApplication>
Avatar of marcparillo
marcparillo

ASKER

Thanks for taking a look.  I'm using Flash Builder from CS5.  I assume I have the latest SDK loaded.  
How can I determine which SDK I have loaded?
" I'm using Flash Builder from CS5" how?
If you are using Flex Builder you can check from Project->Properties->Flex Compiler

But if you are using CS5 you cannot use MXML
I'm using Flash Builder 4 from Adobe's Creative Suite 5 release.
Project->Properties->Flex Compiler says I'm using SDK 4.0.
What do you mean I can't use MXML with CS5?  
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial