•  
  •  

Flex 1.5 htmlText Property

In Macromedia Flex 1.5, there is a bit of fun to be had with htmlText in the <mx:Text> component. I was recently building an application in which I was displaying some content from a datasource when, for the strangest reason, some of the content just would not display. I plugged around for a while until I found the following:

I ran into a bug with <mx:Text> not displaying HTML correctly when embedded fonts are used. It turns out that the htmlText property cannot be used with embedded fonts unless you use a font tag specifying the font face in the htmlText.

There are two possible solutions:

One is to add a font tag around the dynamic content as shown below.

<mx:Text id="body_text"
width="432"
htmlText="<font face=''futura''>{ myResult.body }</font>"
/>

The other solution would be to edit the text being sent in so that it is enclosed in the same font tag.

About Rob Rusher

In his role as Principal Consultant for On3, Rob leads an software development practice to help his clients build rich Internet applications for the desktop, browser, and mobile devices, and to rapidly increase their knowledge and skills to better support their organization's goals. Rob is an Adobe Certified Expert, Community Professional, and Certified Instructor. He has taught and mentored the technical teams at HP, Overstock, Paychex, SAS, the FedEx, and other Government and Fortune 100 organizations. Rob has co-authored four best-selling books on building secure, cutting-edge and rapidly developed applications using Adobe AIR, ColdFusion and Flex. He is very active in organizing and speaking at RIA, Adobe LiveCycle, mobile conferences, and user groups. In addition to growing his software consulting practice, On3, Rob has been building expertise in rich client application development on a wider variety of devices and platforms that extend the applications to change the way we all create and live.