How to use Subscript & Superscript in dynamic and input text field in Flash?
Issue: <sub> & <sup> tags are not supported by Flash.Download Subscript & Superscript Fonts
Ok.. this is a “fugly” hack to get subscript and superscript support in dynamic text fields in Flash… it was my somewhat successful attempt to get around the fact that you can’t get subscript characters into dynamic text fields by using the HTML <sup> or <sub> tags, there’s nothing in the CSS support in Flash, and there’s no .subscript or .superscript properties for the textFormat object. So basically if you want to show 24 or 142312(n2) or I2 in a dynamic text field in Flash you’re kind of screwed (unless you do some whacked out hack like I did).
So basically what I found is a set of unicode characters in Microsoft Sans Serif (the only font that I could find that had 0-9, n, (), and [] in both superscript and subscript) and embedded them in the SWF. I then have code that will look through an HTML string for subscript or superscript tags and replace the text within them with the corresponding unicode characters.... there’s also a function that looks for the unicode characters, and if it finds any in a string it will replace them with plain ASCII characters wrapped in either the sup or sub tag.. a hack that basically gives Flash support for a limited range of superscript and subscript characters.
If anybody has suggestions please lemme know..
Download Subscript & Superscript Fonts
oh… and PLEASE go submit a request to Macromedia to add support for the <sub> and <sup> tags. http://www.macromedia.com/support/email/wishform/
The trackback URL for this entry is: http://oddhammer.com/index.php/trackback/42/mYy8BzS5/
Superscript fonts in dynamic text fields? Flash