Sometimes we need to do some rich text formatting in a Label which may include “SuperScript” and “SubScript”.
Flex 4 and spark controls offer a very strong and easy way to implement this through “Text Layout Framework” . Flex 3 can also use the same provided we have included the swc of TextLayoutFramework. This is pre-included in Flash Builder 4.
The property we use is baselineShift of textFlow object of RichText controls.
A very similar example of how to use this in button is given at : http://cookbooks.adobe.com/post_Superscript___Subscript_with_Text_Layout_Framework-18175.html
But to use this for a Label where we don’t need the user interaction to achieve the same we need to set the “baselineShift”.
Below sample illustrates the usage of the same, both in MXML and ActionScript: