Friday, March 13, 2009

CHAPTER 2 - Display information in a dynamic text box

Dynamic text boxes can display changing content in a Flash movie. You use the Property inspector to create a dynamic text box and assign it a variable name. The value of the variable is displayed in the text field.

In the puzzle.fla file, a dynamic text box displays puzzle piece numbers when a user Shift-clicks a piece. Now you’ll assign a variable name for the dynamic text box.

1 If necessary, choose File > Open and choose the version of the mypuzzle.fla file that you last saved.

Note: You can also browse to your Flash MX application folder and open Tutorials/ActionScript/Finished/ puzzle3.fla. If you do use the puzzle3.fla file, save the file with a new name in your My_Puzzle folder to maintain an unadulterated version of the original file.

2 In the Timeline, unlock the Piece numbers guide layer if it is locked.

3 Double-click the Piece number circle movie clip on the Stage under the lower right corner of the puzzle solution area.























Piece number circle movie clip


This opens the Piece number circle in symbol-editing mode.


4 Select the Text layer in the Timeline. On the Stage, click the center of the Piece number circle to select the text field.







5 If the Property inspector is not open, choose Window > Properties. In the Property inspector, select Dynamic Text from the Text Type pop-up menu.

6 In the Line Type pop-up menu, verify that Single Line is selected.

7 Type _root.pieceNumber in the Var text box and press Enter or Return.








All variables, like functions and movie clips, must be referenced by their paths. The pieceNumber variable is declared and updated in the RotateDisplayOrDrag function on the main Timeline, but the variable text box is in the Piece number circle Timeline. When you enter the full path to the pieceNumber variable, the value updates and displays in the text field on the Stage whenever the variable’s value changes on the main Timeline.

8 Either choose Edit > Edit Document, click the Back button, or click Scene 1 to return to the main Timeline.

9 Choose File > Save As and enter a new filename. Use a consecutive naming scheme so you can revert to earlier versions of the file if necessary.


.
.
==============================================
.
Contents
Trademarks
CHAPTER 1 - Introduction to Flash MX Tutorial
CHAPTER 1 - What you should know
CHAPTER 1 - View the completed movie
CHAPTER 1 - Analyze the stiletto.fla file
CHAPTER 1 - Define properties for a new document and create a ...
CHAPTER 1 - Create and mask vector art
CHAPTER 1 - Tween bitmap effects within a movie cl...
CHAPTER 1 - Load dynamic text at runtime
CHAPTER 1 - Add animation and navigation to button...
CHAPTER 1 - Add streaming and event sounds
CHAPTER 1 - Organize your Library panel
CHAPTER 1 - Test download performance and publish ...
CHAPTER 1 - The next steps
.
CHAPTER 2 - Introduction to ActionScript Tutorial
CHAPTER 2 - View a completed movie
CHAPTER 2 - Initialize the movie
CHAPTER 2 - Save and retrieve information
CHAPTER 2 - Display information in a dynamic text ...
CHAPTER 2 - Write an expression
CHAPTER 2 - Control the flow ofthe movie
CHAPTER 2 - Create commands and reuse code
CHAPTER 2 - Use a built-in object
CHAPTER 2 - Test the movie
CHAPTER 2 - The next steps
.
CHAPTER 3 - Introduction to Components Tutorial
CHAPTER 3 - Types of components
CHAPTER 3 - View the completed form
CHAPTER 3 - Create a form
CHAPTER 3 - The next steps
.
==============================================