Mark Lapasa
Mark Lapasa

Reputation: 1654

Superscript in TextField

I have a project where I need to show a TextField with a monetary ammount

var tf:TextField = new TextField()
tf.htmlText = "<font size=\"30\">1</font>99";

This will show the 99 cents as subscript. How do I show this as superscript?

It's important that I display this in the same textfield so I don't have to worry about 2,3, or 4 digit dollar values or values with no cents. The alignment will be a lot of work.

I googled the GG Superscript fonts but because this is dealing with localization, I need to use device fonts rather thatn embedded. Also size is priority so embedding fonts is something that is not really an option.

Upvotes: 1

Views: 5246

Answers (2)

Swati Singh
Swati Singh

Reputation: 1863

You will need to install GG Subscript & GG Superscript TrueType fonts,and after that need to restart Flash software after installed fonts.

 var tf:TextField = new TextField();
 tf.htmlText = "1<font face=\"GG Superscript\">99</font>";

Upvotes: 4

AsTheWormTurns
AsTheWormTurns

Reputation: 1316

you can use a TLFTextField from the Text Layout Framework.

This is from the last example at this URL:

http://flashthusiast.com/2010/05/05/getting-started-with-the-tlftextfield-class-in-actionscript-3-0-and-flash-cs5/

<span baselineShift='superscript'>over</span>

Check this one too.

Upvotes: 7

Related Questions