That was hard to read.  Maybe use pastebin and post a link.  I'm going to guess 
at an answer assuming I've read the code correctly.

I think in Flex, the type-selector will override inheriting behavior.  If you 
don't specify font-family in s|Label, then does it pick it up from the 
BottomControlBar?

I think you can set the styleName property of the Label to the instance of 
BottomControlBar and then the Label will pick up the styles from the bottom 
control bar.

-Alex

On 4/18/19, 11:16 AM, "kamcknig" <[email protected]> wrote:

    I'm not very good with styles in flex but I'm attempting to add a style to a
    component and have the labels as children inherit the style.
    In my external style sheet I have the following.
    @namespace s "library://ns.adobe.com/flex/spark";@namespace controlbars
    "com.accesso.views.controlbars.*";controlbars|BottomControlBar{    color:
    #424242;    font-family: openSansRegular;    fontSize: 10;}s|Label{
    fontFamily: openSansRegular;        fontSize: 14;   textAlign: "left";      
lineHeight:
    "125%";     color: #212121;}
    BottomControlBar inherits from Group and has a style defined in its Metadata
    tag. Its content contains multiple labels (which are themselves children of
    other component such as other Groups). Below is a simplified example of the
    structure. The custom component itself has a custom skin class made up of
    two Labels. In this example both the Group->HGroup->Label and the
    Group->HGroup->custom:Component Labels do not have the styling that I've
    declared in my CSS. They do however, have the styling that was applied as
    the base Label style via the s|Label selector
    &lt;s:Group 
xmlns:fx="https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&amp;data=02%7C01%7Caharui%40adobe.com%7C76f90750eb4f4e41fce408d6c42a01c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C636912082033905502&amp;sdata=Kl3RZKoip%2FKM3U1vCC%2BZg4A3bw678htsy4BLtVDEbr0%3D&amp;reserved=0";
        
    xmlns:s="library://ns.adobe.com/flex/spark"&gt;    &lt;fx:Metadata&gt;      
 
    [Style(name="fontFamily", type="String", inherit="yes")]   
    &lt;/fx:Metadata&gt;    &lt;s:Group&gt;        &lt;s:HGroup&gt;           
    &lt;s:Label /&gt;            &lt;custom:Component /&gt;       
    &lt;/s:HGroup&gt;    &lt;/s:Group&gt;&lt;/s:Group&gt;
    I have added an override in BottomControlBar and the getStyle method returns
    the correct 'openSansRegular' fontFamily and 10 for fontSize so the style is
    getting applied to BottomControlBar, it's just not being inherited by it's
    children from what I can tell
    override public function stylesInitialized():void{   
    super.stylesInitialized();    trace("BottomControlBar", "stylesInitialized",
    getStyle('fontFamily'));    trace("BottomControlBar", "stylesInitialized",
    getStyle('fontSize'));}
    I'm unsure how to debug this, could anyone help point me in the right
    direction?Kyle
    
    
    
    --
    Sent from: 
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-flex-users.2333346.n4.nabble.com%2F&amp;data=02%7C01%7Caharui%40adobe.com%7C76f90750eb4f4e41fce408d6c42a01c7%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C636912082033905502&amp;sdata=rlZ%2Fc%2FDG%2FM7jvtDr7ncEXDdi7l0use%2F1wrTm8kg4ZMI%3D&amp;reserved=0
    

Reply via email to