1 Reply Latest reply on Feb 12, 2010 8:54 AM by Paul Reilly

    CSS inheritance metadata compiler error?

    Bryan Dresselhaus Level 1

      Can anyone explain why this style is conflicting?  Container extends UIComponent, so why would it conflict with another class that extends UIComponent?  Shouldn't they be scoped independently?

       

           [Style(name="backgroundColor", type="uint", format="Color", inherit="yes")]
      
           public class ShapeGraphic extends UIComponent
           {
                public function ShapeGraphic()
                {
                     super();
                }                           
           }
      

       

       

      Results in compile error:

       

      Declaration of style 'backgroundColor' conflicts with previous declaration in C:\Program Files\Adobe\Flex Builder 3\sdks\3.5\frameworks\libs\framework.swc(mx/core/Container).

        • 1. Re: CSS inheritance metadata compiler error?
          Paul Reilly Level 1

          Whether a style is inheriting or not isn't something that can currently be scoped to component.  It's something that is maintained at the application or module level. This is mostly due to the runtime implementation of StyleManager.  It keeps a list of what styles are inheriting.

           

          For backgroundColor, framework.swc's mx.core.Container has already declared that backgroundColor is not inheriting, so it's an error to try to change that in another component.  If you need ShapeGraphic to be able to inherit it's background color from a parent component, you can use a different style name, for example shapeGraphicBackgroundColor.  It's not ideal, but until style inheritance information is maintained on a per component basis, there aren't any terrific options.