Archive

Archive for January, 2010

Label HtmlText in Flex

January 7, 2010 1 comment

While working on some stuffs with related to htmltext using some styles for Label, it seems to be not displaying the text.

Here were the some sample scripts denoting the error which i encountered

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;
initialize=”init()”
layout=”vertical”>
<mx:Label>
<mx:htmlText>
<![CDATA[
Label text goes here
]]>
</mx:htmlText>
</mx:Label>

</mx:Application>

It might seems to be fine with the above code, but it wont display the text, since the text entered in the CDATA section is on the second line. While working on stuffs with various html tags inside the same line, it might be very hard to figure out this silly mistakes sometimes.

The working version of the above staments would need to be like this

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;
initialize=”init()”
layout=”vertical”>
<mx:Label>
<mx:htmlText>
<![CDATA[Label text goes here]]>
</mx:htmlText>
</mx:Label>

</mx:Application>

I guess it should be a IDE enhancement stuff when using htmlText inside Label, the cursor should default to be on the first line of the CDATA section of the Label control.(The Label control is a noneditable single-line text label)

Advertisements
Categories: Components, Flex