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
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Metadata>
[Style(name="fontFamily", type="String", inherit="yes")]
</fx:Metadata> <s:Group> <s:HGroup>
<s:Label /> <custom:Component />
</s:HGroup> </s:Group></s:Group>
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: http://apache-flex-users.2333346.n4.nabble.com/