2 Select Actions
Select "Actions" from the "Window" menu on the main Flash menu bar to open the ActionScript 3 editor.
Position your mouse cursor on the first line of the ActionScript 3 editor. Click your mouse button, and type in the code below to create and place a TextField on the flash stage that has a width of 1,000 pixels and a height of 1,000 pixels:
var displayText:TextField = new TextField(); displayText.width = 1000 displayText.height = 1000 displayText.multiline = true; var tf:TextFormat = new TextFormat(); tf.size = 20; tf.font = "Times New Roman"
The TextField will also support text on multiple lines and display the text with a 20 point Times Roman font.
Type the following code into the ActionScript 3 editor starting on the next line:
displayText.htmlText = "
Formatted in Plain Text
Formatted in Bold Text
Formatted in Italic Text
the equation\n\nV= 1_PI_1²
"This code stores the HTML formatted text on the right-hand side of the equals sign in the displayText TextField variable.
Type the following code in the next line of the ActionScript 3 editor:
displayText.setTextFormat(tf); addChild(displayText);
This applies the text formatting to the displayText TextField, and places the displayText TextField on the Flash stage.
Copy and paste the following code, if you did not type in the preceding code already, or replace the code you already typed, to ensure that there are no syntax errors and the AS3 HTML rendering program runs correctly.
var displayText:TextField = new TextField(); displayText.width = 1000 displayText.height = 1000 displayText.multiline = true; var tf:TextFormat = new TextFormat(); tf.size = 20; tf.font = "Times New Roman"
displayText.htmlText = "
Formatted in Plain Text
Formatted in Bold Text
Formatted in Italic Text
the equation\n\nV= 1_PI_1²
"displayText.setTextFormat(tf); addChild(displayText);
Click "TestMovie" option within the "Control" menu to play the Flash AS3 HTML rendering program. Observe that the text is displayed and formatted in plain, bold and italic text, that the XML character is rendered as the superscript 2, the text is in 20 point Times Roman format and that the picture at the WikeMedia Common's URL is rendered.