Search code examples
apache-flexflex-spark

Spark Label rollover color


I have a group of spark label components within a VGroup. Is there a way to change the background color to the labels when the user rolls over them? I've tried adding rollOverColor to the VGroup, but it didn't work.


Solution

  • <s:VGroup>
        <s:Group rollOut="aRect.visible=false"
                 rollOver="aRect.visible=true">
            <s:Rect height="100%"
                    id="aRect"
                    width="100%">
                <s:fill>
                    <s:SolidColor color="red"/>
                </s:fill>
            </s:Rect>
            <s:Label text="This is some label"/>
        </s:Group>
    </s:VGroup>
    

    You could throw the group portion from the code above into it's own MXML and declare a public var text that you bind to the label's text property. Alternatively you could do this based on states, more on that here: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf63611-7ff1.html