1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

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

By

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”.

©2014 About.com. All rights reserved.