SpanElement backgroundColor not working as expected
- August 25, 2009
- 1 reply
- 983 views
I am adding a simple RichText element with a SpanElement as the content. I am setting the backgrounColor of the span, but rather than highlighting the entire text, it is only highlighting the top few pixels of the first line of text.
Is this a bug or am I doing something wrong?
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/halo"
width="100%" height="150"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
[Bindable]
public var imageUrl:String;
[Bindable]
public var caption:String;
]]>
</fx:Script>
<mx:Image source="{imageUrl}" width="210" height="150" x="{(width - 210) / 2}" />
<s:Group>
<s:RichText width="135" height="100%">
<s:content>
<s:span fontSize="16" fontFamily="times, serif" color="#000000" backgroundColor="#ff0000" text="{caption}"/>
</s:content>
</s:RichText>
</s:Group>
</mx:Canvas>
