• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Classes > About object-oriented programming and Flash

About object-oriented programming and Flash

ActionScript 2.0 is an object-oriented language. Like ActionScript, OOP languages are based on the concept of classes and instances. A class defines all of the properties that distinguish a series of objects. For example, a User class represents a bunch of users who are using your application. Then, you have an instantiation of the class, which, for the User class, is one of the individual users—one of its members. The instantiation produces an instance of the User class, and that instance has all of the properties of the User class.

Classes are also considered like data types or templates that you can create to define a new type of object. For example, if you need a data type of Lettuce in your application, you might write the Lettuce class. This defines the Lettuce object, and then you can assign your Lettuce methods (wash()) and properties (leafy or bugs). To define a class, you use the class keyword in an external script file. You can create an external script file in the Flash authoring tool by selecting File > New and then selecting ActionScript File.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint