1. Home
  2. Computing & Technology
  3. Animation

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

By , About.com Guide

9 of 9

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) ;
_root.displayvalue.text=redwidth;
}

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.

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.