Using Objects in ActionScript > Using a button as an object

 

Using a button as an object

You can use a button as an object in your movie, and use ActionScript to control the button in the same way you would control a movie clip or other object. Button objects support the same properties as MovieClip objects, with the exception of the _currentframe, _droptarget, _framesloaded, and _totalframes properties. You can get and set properties and invoke methods for buttons dynamically.

The Debug > List Objects command in test mode supports button objects. If an instance name is specified for a button, the full target path, including the instance name, is displayed in the Output window in the following form:

Target = "target path"

For more information on the List Objects command, see Using the Output window.

 
To use a button as an object:

1

Select a button instance on the Stage.

2

In the Property inspector (Window > Properties), enter an instance name in the Instance Name text box, directly below the Symbol Behavior pop-up menu on the left side of the inspector.

The instance name must conform to identifier naming conventions. The first character must be a letter, underscore (_), or dollar sign ($). Each subsequent character must be a letter, number, underscore, or dollar sign.