4 Replies Latest reply on Feb 11, 2012 7:18 AM by wu0773

    defaults.css sporadically ignored

    tehxike1 Level 1

      I have a shared library project that specifies skins for common elements (scrollbars, buttons, etc.) in a defaults.css file.  The AIR and Flex applications that use this library usually pick up the styles fine, but sometimes they seem to be overridden by normal skins.  Skins for custom components are always found, as there's no other skin specified for them anywhere.  Components from other shared libraries with local skins also often default to their library skins rather than the local ones.


      Sometimes I can resolve this by cleaning my projects a few times.  I've hit it a few times though where even cleaning didn't resolve the problem, and the only resolution was to delete all of the projects and check them out of SVN again.  Is this a known issue?  I can't produce it consistently enough to create a test case to attach to a Jira.

        • 1. Re: defaults.css sporadically ignored
          mitchgrrt Level 1

          I just was having the same problem  I made a  small example with 3 source files.  defaults.css:

          @namespace s "library://ns.adobe.com/flex/spark";
          @namespace mx "library://ns.adobe.com/flex/mx";


          .labelStyle {
              fontSize    : 20;
              color        : #ff0000;



          <?xml version="1.0" encoding="utf-8"?>
          <s:Label xmlns:fx="http://ns.adobe.com/mxml/2009"





          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         minWidth="955" minHeight="600">


              <lib:MyLabel text="hello" />



          The  first two are compiled into the .swc library project and the third is  in a regular Flex project.  According to the docs the default.css file  should work but it's not working for me.  No styles are getting picked  up.


          I also tried adding this to the Flex Compiler options in the library project, and that didn't help:



          Does anybody know how to set this up?  I'm using Flash Builder 4 on a Mac, with Flex sdk 4.1.  Flash Builder is standalone and not the Eclipse plugin.  Thanks.

          • 2. Re: defaults.css sporadically ignored
            Darrell Loverin Level 4

            Are you using the -include-file option to add the defaults.css to the swc?




            • 3. Re: defaults.css sporadically ignored
              mitchgrrt Level 1

              Yes that worked.  The argument in "additional compiler arguments" is





              • 4. Re: defaults.css sporadically ignored
                wu0773 Level 1



                I created a new set of Flex component library slib.swc (Flex 4.5). Would also like to have a default style. defaults.css file, making it the default style of the component library.

                Like flex the builder install directory of sdks \ 4.5.0 \ frameworks out \ libs directory has a spark.swc file, open with Winrar will see defaults.css this file. Defaults.css file defines the default style of the flex spark components.

                How can it be achieved?


                As follows

                slib.swc contains a CLabelEx components, and a defaults.css file

                defaults.css source file as follows:

                @ namespace s "library :/ / ns.adobe.com / flex / spark";
                @ namespace mx "library :/ / ns.adobe.com / flex / mx";
                @ namespace cn "http://os.slib.cn";

                cn | CLabelEx
                        styBackgroundAlpha: 1;
                        styBackgroundColor: # 569CC0;
                        styBorderAlpha: 1;
                        styBorderColor: # 569CC0;
                        styBorderWeight: 1;
                        styCornerRadius: 3;

                In slib.swc the application MyLabel.mxml of the source file as follows:
                <? xml version = "1.0" encoding = "utf-8"?>
                <s: Application, the xmlns: fx = "http://ns.adobe.com/mxml/2009
                                           xmlns: s = "library :/ / ns.adobe.com / flex / spark"
                                           xmlns: mx = "library :/ / ns.adobe.com / flex / mx"
                                           xmlns: cn = "http://os.slib.cn
                                           the minWidth = "955" The minHeight = "600">
                        </ fxeclarations>
                        <cn:CLabelEx x="67" y="112"/>
                </ s: Application>


                I hope CLabelEx default use cn | CLabelEx, style to display its appearance.


                I refer to above approach, but failed to achieve. Can you please re-Detailed