Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this chapter we're going to be working with text. Specifically we'll talk about loading text from an external text file, displaying HTML code in Flash, and working with CSS in Flash. We'll start by talking about dynamic text fields. If you're following along, I'm working in 01_dynamic_text.fla in the Chapter 03 folder in the Exercise Files folder. Now this file has two layers - actions and text field. There's no action script in the actions layer and there's no art of the text layer.
So we'll start by drawing a dynamic text field. Make sure the text field layer is selected and select the Text tool the toolbar. In the Property inspector, choose Dynamic Text for the text type. Pick a font, I picked Trebuchet MS, you can pick any font you want. And pick a font size and a font color. Also make sure the Line Type is set to Multiline. Let's also make the text selectable by clicking the Selectable button and show a border around the text by selecting the Show border around text button. Now let's draw the text field on the stage.
Click and drag to try a text field on the stage, roughly the same size as the text field I just drew. It doesn't need to be exact by any means, but roughly this size is fine. Once you've drawn the dynamic text field, press Escape on your keyboard to exit text editing mode. Let's talk about what dynamic text fields are. Dynamic text fields are a special kind of text field in Flash. Maybe up to this point you are only familiar with working with static text fields. Static text fields display text that you type yourself in Flash.
Dynamic text fields have the ability to update using ActionScript while your Flash movie is playing. Using a dynamic text field, you can also display text that's stored in an external text file, which is what we're going to do in this chapter. Once you create a dynamic text field, in order to work with it in ActionScript, you need to first give that text field an instance name. So with the text field selected, find the Instance Name field at the left side of Property inspector. Click in the Instance Name field and give this text field an instance name of external_txt.
Ending your text field's instance name with _txt, will give you access to code hinting in ActionScript this works in the same way as ending a button instance name with _btn, or a movie clip's instance name with _mc. So once you've created a dynamic text field on the stage and get an instance name, you can then start working with a text field in ActionScript. In the next movie, we'll load text from an external file into this text field.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 60095 Viewers
61 Video lessons · 92736 Viewers
82 Video lessons · 104198 Viewers
56 Video lessons · 107197 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.