Accessibility
 
Home > Products > Flash > Support > Using ActionScript
Flash Icon Macromedia Flash Support Center - Using ActionScript
Using objects in Macromedia Flash MX

Macromedia Flash MX ActionScript provides enhanced object support that improves the integration of movie clips, buttons, and text fields into the ActionScript object model.

In Macromedia Flash 5 ActionScript, movie clips were always assigned to the class MovieClip. The MovieClip class does not support prototype-based inheritance, so it was not possible to extend movie clips with additional properties and methods using the prototype system. In Macromedia Flash MX, movie clips can be assigned to an object class. Since object classes support prototype-based inheritance, it is now possible to extend movie clips with additional properties and methods using the prototype system.

Buttons could not be represented as objects in Macromedia Flash 5 ActionScript. In Macromedia Flash MX ActionScript, buttons can be assigned instance names, and are reflected in ActionScript as objects, controlled by methods. Similarly, text fields were represented only as variable names in Macromedia Flash 5 ActionScript. In Macromedia Flash MX ActionScript, text fields can be assigned instance names, and are reflected in ActionScript as objects, controlled by methods. Both Button and TextField 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 and text fields. You can also create text fields dynamically.

The following live sample uses a custom class for the Ball movie clip, and sets properties for the Button and TextField objects. Click the buttons and press the Spacebar to see how the movie's interactivity works.


To view this demo, you need the latest version of the Macromedia Flash Player.
Download the free Macromedia Flash Player now.

Get Macromedia Flash Player

This tutorial is intended for Macromedia Flash users who have a basic familiarity with ActionScript. For best results in using this tutorial, you should be familiar with the Macromedia Flash ActionScript panel and know how to assign actions to buttons, frames, and movie clips. You should also be familiar with using functions, properties, and methods. For more information, see Macromedia Flash MX Help > Using Flash > Writing Scripts with ActionScript. You can also complete the Introduction to ActionScript tutorial, see Macromedia Flash MX Help > Tutorials.

Download the Windows source files (16K).
Download the Macintosh source files (12K).

When the file decompresses, a folder named object_model is created on your system.

If you have trouble downloading or decompressing the files, see TechNote 13686.

About objects and classes
About creating classes
About inheritance in classes
About class assignment and order of execution in ActionScript
Assign a class to a movie clip
Use a button as an object
Use a text field as an object
View Button and TextField objects in the Output window
Enhanced object support in your movies


Mary Burger

Mary Burger is a Senior Technical Writer at Macromedia. She specializes in Macromedia Flash documentation.


22 April 2002

object, class, movieClip class, button object, textField object, ActionScript, tutorial

9910