1. Home
  2. Computing & Technology
  3. Animation

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

By , About.com Guide

8 of 9

However, we want the text box to display the actual width of the object as returned by the getProperty function. This is where we assign a variable to that value; click on the getProperty function, and then in the Expressions field, assign a variable name before the function:

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

What I’ve just told Flash is that the value of variable redwidth is equal to whatever number the getProperty function returns as the width of the Movie Clip instance. If the width is ten pixels, then redwidth=10; if the width is 300 pixels, then redwith=300.

Just like instance names, variable names can be pretty much anything that your wild little imagination can contrive--as long as the name doesn’t perfectly match the text defining a script/function. Trying to name your instances or variables after ActionScripts will get you a right mess.

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.