GG's Flash Blog

04/19/07

How to use subscript & superscript in dynamic and input text field

Permalink 05:51:49 pm, Categories: ActionScript, Flash & HTML, Font, 221 words

Issue:

  • Unable to use subscript or superscript in dynamic and input text field.
  • Unable to display subscript or superscript for external loaded text.
  • Unable to use <sub> & <sup> tags in dynamic or input text field.

Reason:
<sub> & <sup> tags are not supported by Flash.

TechNote: Subscript and superscript fail in dynamic and input text fields
LiveDocs: Supported HTML tags

Solution:

  1. Download & install GG Subscript & GG Superscript TrueType fonts. You will need to restart Flash software after installed fonts.

  2. Create a dynamic text field with Arial font embeded. Set the HTML property to true.

  3. Create a dynamic text field with GG Subscript font embeded.

  4. Create a dynamic text field with GG Superscript font embeded.

  5. Use HTML tag to set text to subscript or superscript like below:

    Adobe<font face="GG Superscript">TM</font>

    If you are using ActionScript to test the htmlText, use script like below:

    my_txt.text = "Adobe<font face=\"GG Superscript\">TM</font>";

View sample: superscript.swf
Download sample: superscript.fla superscript.swf

NEW! (2008-09-21)
A new set of superscript & subscript fonts includes both sans & serif type, with more complete & improved glyphs, standard scale & shift, is now available to be downloaded (free) from here.

Permalink Share/Save/Bookmark Subscribe 21 feedbacks

Comments, Pingbacks:

Comment from: Aisha [Visitor]
Thanks sooo much, I just had a very disappointing experience when I found that my way of importing various unicode characters from text files only worked on Macs, and I was at a loss - but you fixed the subscript/superscript part of my problem (the biggest part). Thanks again
Permalink 07/13/07 @ 22:27
Comment from: senthil kumar [Visitor] Email
Just now im hearing this superscript along with the flash. Nice to learn
Permalink 08/21/07 @ 17:32
Comment from: Yin [Visitor] Email
wow. you totally made my day. I've been trying to put subscripts in all week!! Thanks so much!
Permalink 11/08/07 @ 06:27
Comment from: GW [Visitor]
Works great! You made my day. Thanks so much.
Permalink 12/21/07 @ 01:09
Comment from: Aaron Beall [Visitor] Email · http://abeall.com
You don't know how long I've been looking for these two fonts. Well, I'll tell you: about the last 4 years. All other hacks I've tried have had issues. Thank-you very much for sharing!!

- aaron
Permalink 01/24/08 @ 11:17
Comment from: flo [Visitor] Email
Couldn't believe there's no native support for subscript tags in flash. You helped me out... thank you so much!

flo
Permalink 02/13/08 @ 19:01
Comment from: priti [Visitor] Email
thank u so much.
Permalink 05/30/08 @ 19:42
Comment from: G [Member] Email · http://www.ggshow.com
Here is a nice solution for using GG superscript & GG subscript with <sup> & <sub> tag

http://www.psyked.co.uk/adobe/flash/superscript-and-subscript-with-actionscript.htm
Permalink 07/12/08 @ 18:28
Comment from: G [Member] Email · http://www.ggshow.com
Also work in flex

http://jasonbejot.com/?p=3
Permalink 07/12/08 @ 18:32
Comment from: Wally [Visitor] Email
thats good
Permalink 09/28/08 @ 20:26
Comment from: Evan Gifford [Visitor] Email · http://blitzagency.com
Nice tip, it's a real timesave. Thank you very much!
Permalink 10/23/08 @ 07:57
Comment from: JRM [Visitor] Email · http://jrm-teks.co.uk
Am I right in saying this doesn't work in Flash 7? (I know who targets flash 7...!)
Permalink 01/14/09 @ 19:05
Comment from: G [Member] Email · http://www.ggshow.com
Hi JRM,

I've tested this solution in Flash Player 7, 8, 9 (CS3), both AS2 & AS3, it works.
If you have problem using the fonts in Flash 7, you can send me your FLA file I'll look at it.
Permalink 01/14/09 @ 23:09
Comment from: parkej60 [Visitor] Email
Anyone know if there is a way to get this text to be bold?
Permalink 01/18/09 @ 23:36
Comment from: G [Member] Email · http://www.ggshow.com
You need to ensure that you have embeded the bold font. Set the font to bold for the dynamic text field which used to embed font.

If you need multiple style (regular, bold, italic, bold italic), you will need to use multiple dynamic text field to embed the fonts. E.g. create 4 dynamic text fields, one with regular font, one to embed bold font, one for italic, and one for bold italic. Embed font for all the 4 text fields.

If you need only regular and bold styles, use only 2 dynamic text fields for font embeding. Now you should be able to have bold in your superscript.
Adobe<font face="GG Superscript"><b>TM <b>Adobe<font face="GG Superscript">TM</font></b>
Permalink 01/19/09 @ 00:51
Comment from: parkej60 [Visitor] Email
The GG font apparently only allows for you to embed it as a regular font style, it doesn't appear to have a bold font style.

If I import it with Faux Bold checked it doesn't seem to change anything.

Permalink 01/19/09 @ 03:09
Comment from: G [Member] Email · http://www.ggshow.com
Example below uses GG Superscript Sans font, with regular, bold, italic, bold italic.

Permalink 01/19/09 @ 12:25
Comment from: jairus [Visitor] Email · http://jairus.freehostia.com
wow, thanks a lot for the great tip, works perfectly for me :D
Permalink 02/02/09 @ 10:57
Comment from: delux [Visitor] Email · http://www.981delux.com
Great font's,serious problem solved on this project I'm working on, in fact before I found this site I was about to buy them of that guys site you talk about above (the fairly blatant theft is incredible) instead I'll make a donation to you, thanks.
Permalink 07/16/09 @ 00:31
Comment from: nils ellis [Visitor] Email · http://www.amd.com
I can't even tell you how much this fix has helped my team and I!!

Nils Ellis
Integrated Marketing Communications – Sr. Designer
Advanced Micro Devices, Inc.
Permalink 08/06/09 @ 00:16
Comment from: Jitendra [Visitor]
It's really a great help of me. I have been searching the solution for last many days. Thank you so much. Jitendra Panwar
Permalink 09/08/09 @ 09:56

This post has 10 feedbacks awaiting moderation...

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

Next post: Cross-domain policy

XeerSoft - Web-based Integrated Global Business Solution Provider

Accounting, Inventory, Reservation, Transportation, Commission, Point of Sale (POS), CRM, Membership, Time Attendance, Payroll, Human Resource, Manufacturing, Merchandising, Financial, Workflow...
http://www.xeersoft.com


Your ads here

Flash Reference

To share what I have learned from people who have shared.

 << <March 2010> >>
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search

Categories

Archives

Who's Online?

Account

Syndicate

Donation

If you find GG's Flash extensions or any of our resources useful, help support future development by making a donation.

Ads

Valid XHTML || Valid CSS || Valid RSS || Valid Atom

Copyright © 2006-2009 GGSHOW. All Rights Reserved.
GGSHOW.COM | GGSHOW.NET
eBoaY | tuBabe | syndicater | Nobody's Website | NeverTheLink | NiShiZuiHaoDeNiZhiDaoMa | WorldCoin