User Guide
Summary 121
9.
Define private methods in the class that use the existing movie clip methods, startDrag() and
stopDrag():
class Drag extends MovieClip
{
function Drag()
{
onPress=doDrag;
onRelease=doDrop;
}
private function doDrag():Void
{
this.startDrag();
}
private function doDrop():Void
{
this.stopDrag()
}
}
10.
Save the ActionScript file.
11.
Test the Shape.fla document. You should be able to drag the movie clip.
Note: An example of the ActionScript file you just created, named Drag.as, is located in your finished
files folder. For the path, see “Set up your workspace” on page 113.
Summary
Congratulations on learning how to work with objects and classes in ActionScript 2.0. In a few
minutes, you learned how to accomplish the following tasks:
• Create and use objects from existing classes
• Create a custom class
• Create a property within a custom class
• Create a method within a custom class
• Extend an existing class and take advantage of inheritance