I've got a really really basic question about the scope of application level 
styles.

At the app level there's a

        s|Label  {font-size:11;} 

style and with that in place it seems that *every* Spark Button has an 11-point 
label and that can't be overridden!  Is there any way to override that 
app-level setting on particular buttons?

Here's the code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"; 
                           xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Style>
                @namespace s "library://ns.adobe.com/flex/spark";
                s|Label {
                        font-size: 10;
                }
        </fx:Style>
        <s:Button id="b1" label="test" fontSize="30"/>
</s:Application>

If you run it, what'll you'll see is a 10-point "test" button, not a 30-point 
"test" button.

I believe I'm seeing this behavior because SparkButtonSkin's labelDisplay is a 
Label.  I can make a new button skin and set the fontSize on labelDisplay and 
that solves the problem, but that's pretty clumsy.

Even doing b1.setStyle("fontSize", 30) in a creationComplete handler or a click 
handler for another button doesn't cause the font of b1 to change.  (I stepped 
through the framework code for that call, and I just didn't see a place where 
labelDisplay's fontSize is ever touched.)

It sure seems like a bug to me but maybe I'm missing something.

p.s.
You might ask, "Why not just remove that app-level style for s:Label?"  That's 
a possibility, of course, but in the app where this problem turned up, there 
are a LOT of buttons and labels that would then need to be given a style in 
some other way.

William Mitchell
Research Programmer
School of Information: Science, Technology,  and Arts
The University of Arizona
520-870-6488





Reply via email to