9. Building Out the Class
In the last chapter, you learned what a class is, created a RedButton class file, and linked it to the Library object; but you didn’t step through the code to analyze what it was doing or how it was doing it. So, let’s do that now and add to it the code to define how the red button looks and behaves.
Parts of a Class
All classes have a few basic parts. Take a look at the RedButton class code and dissect what the parts of the code do:
package { import flash.display.MovieClip; public class RedButton extends MovieClip { public function RedButton() { // constructor code } }}
Package
Statement
The first part is the package
statement. All classes are grouped into categories called packages ...
Get Fundamentals of ActionScript 3.0: Develop and Design now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.