Step 1. | Open the Flash file dynamic_text_example.fla If you don't see the Property Inspector, choose Window > Properties > Properties to display it. |
Step 2. | Using the Text tool, add a text element to the Stage Then, with the text element still selected, choose "Dynamic Text" from the Text type drop-down box in the Property Inspector. Flash redisplays the Property Inspector to include dynamic textrelated properties |
Step 3. | Click the "Instance name" field and type a short, unique name (such as myDynamicTextInstance) for this instance of dynamic text. Then, in the Variable field, type theActualText, which is the name for the text you're going to associate with this dynamic element. The variable name refers to just the dynamic text you'll be creating (as opposed to the whole text element complete with its associated font, color, and other characteristics, which is what the instance name refers to). In the next few steps, you'll create the text file you want Flash to pull in at runtime. |
Step 4. | Using a text editor program, create a text file named myCustom.txt containing the following single line of text: theActualText=Ralph Tip: If you like, you can include HTML tags in your text file. (For example, you can surround a bit of text with the HTML tags <FONT COLOR="red" >your text here</FONT> to pull in red text at runtime.) If you do include HTML tags in your text file, though, make sure you click the "Render text as HTML file" icon in the Property Inspector. If you don't, Flash displays your HTML tags instead of interpreting them. |
Step 5. | |
Step 6. | Click Frame 1 to select it You're creating a frame-based action (as opposed to a text elementbased action) because you want Flash to load your dynamic text as soon as it loads your frame. |
Step 7. | In the Actions panel, type the following ActionScript code loadVariables("myCustom.txt", this); The above line of ActionScript code tells Flash to load the contents of the myCustom.txt file into this animation. When Flash loads the text file, the contents of the file tell Flash what variable you want to plug text into (the variable theActualText), and what the text is (Ralph). |
Step 8. | Test your dynamic text element by choosing Control > Test Movie |
discuss this topic to forum
