Last active
August 29, 2015 14:19
-
-
Save grvgl/f32a49071015ae3aab66 to your computer and use it in GitHub Desktop.
<b> <i> Superscript Subscript in Actionscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import flash.display.MovieClip; | |
import flash.text.TextField; | |
import flash.text.Font; | |
public class BoldItalicSubSuperscript extends MovieClip { | |
// Free Subscript and Superscript fonts are available at | |
// https://storage.googleapis.com/ggshow/files/fonts/GGSUBSCR.TTF | |
// https://storage.googleapis.com/ggshow/files/fonts/GGSUPERS.TTF | |
// And the whole tutorial @ http://www.ggshow.com/how-to-use-subscript-superscript-in-dynamic-and-input-text-field/ | |
public function BoldItalicSubSuperscript() { | |
var txtFld: TextField = new TextField(); | |
txtFld.width = 600; | |
txtFld.height = 600; | |
txtFld.multiline = true; | |
txtFld.embedFonts = true; | |
txtFld.htmlText = "<font face='Arial' size='24'>I have just been <font face='Arial Bold' size='24'>bolded.</font></font>\n<font face='Arial' size='24'>And a line break for </font><font face='Arial Italic' size='24'>italic text.</font>"; | |
txtFld.htmlText += "<font face='Arial' size='24'>This is subscript</font><font face='GG Subscript' size='24'>0123456789qwertyuioplkjhgfdsazxcvbnm</font>"; | |
txtFld.htmlText += "<font face='Arial' size='24'>This is superscript</font><font face='GG Superscript' size='24'>0123456789qwertyuioplkjhgfdsazxcvbnm</font>"; | |
this.addChild(txtFld); | |
stop(); | |
traceFontDetails(); | |
} | |
// Trace the names of fonts used in the fla and use the same name to create new font in the library. | |
// Use the same name to format text. | |
public function traceFontDetails() { | |
var fonts: Array = Font.enumerateFonts(); | |
for (var i: int = 0; i < fonts.length; i++) | |
trace(fonts[i].fontName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment