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


The last thing that we need to do is tell Flash to change the text displayed in the dynamic text field to show the value returned by getProperty (the width of the object). For that we’ll need to change the Expression field for the text property to read:

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

Because this is inside an onClipEven triggered by a down click on the mouse button, the movie will first display the default text value on the stage. After that click, however, the target field’s text will change, displaying the dynamic value called by the function--as long as you leave the quotes off so that Flash recognizes that it needs to display the value of the variable. If you leave the quotes on, then it will display the actual word “redwidth” (or whatever you’ve named your variable).

Take a look.

©2014 About.com. All rights reserved.