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


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) ;

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.

©2014 About.com. All rights reserved.