1. Home
  2. Computing & Technology
  3. Animation

ActionScripting Basics: Using getProperty and Dynamic Text to Display a Value

By , About.com Guide

7 of 9

Right-click on the Movie Clip object and select Actions to open the Actions pane. You should already have a script there displaying the onclipEvent:

onClipEvent (mouseDown) {
getProperty ( _root.red, _width) ;
}

To add the next script, expand Objects->Movie->TextField->Properties->text. Double-click on it to add the script. It will originally appear as follows:

onClipEvent (mouseDown) {
getProperty ( _root.red, _width) ;
.text;
}

The .text field will be highlighted in red, because it is currently incomplete. In the expressions field you need to define two parts of this function: the target text field, and the value to be displayed in that field. You can edit this in the Expressions field:

onClipEvent (mouseDown) {
getProperty ( _root.red, _width) ;
_root.displayvalue.text=”width”;
}

The information before the function name tells Flash what instance name to look for, and on what level. The = (equal) tells Flash that the value of the text for dynamic text field “displayvalue” should be whatever is after the =; if the value is in quotations, then what is inside the quotes will be displayed in the text field. If there are no quotes, then Flash will look for a variable by whatever name is specified. Right now the text box will display the word “width”.

Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. ActionScripting Basics: Using getProperty and Dynamic Text to Display a Value

©2009 About.com, a part of The New York Times Company.

All rights reserved.