Chapter 6. Customizing Objects


Most of us learned in shop class that you've got to use the proper tool for the job at hand anything else can result in botched jobs or, worse, terrible injury. But what do you do if the tool for your task doesn't exist? When Henry Ford started producing cars on an assembly line, he didn't call the assembly-line parts store to purchase the requisite tools; he created his own either from scratch or by enhancing existing tools.

As ActionScripters, we sometimes need to do the same: Since we're creating new Macromedia Flash applications, the basic scripting tools we're accustomed to using (Flash's prebuilt objects) will not always be up to the task. When this is the case, we simply roll up our sleeves and create our own which means you need to understand something about the mechanics of the way objects work in ActionScript.

You will learn about a number of object-oriented scripting principles in the Construct a Face application you will script in this lesson

graphics/06fig01.gif

In this lesson, we'll show you the way objects work and how they're constructed so that you can create new classes of objects from the ground up as well as enhance existing ones.

WHAT YOU WILL LEARN

In this lesson, you will:

  • Learn why objects are so useful

  • Learn about the parent/child relationship created when an object contains another object

  • Create a custom class of objects

  • Work with the prototype object of a class

  • Learn about object inheritance

  • Create a subclass of objects

  • Learn how to watch the properties of an object

  • Create new object methods

  • Enhance the methods of Flash's built-in objects

  • Create new methods for Flash's built-in objects

  • Register a movie clip to a custom object class to cause instances of that clip to inherit specific functionality

APPROXIMATE TIME

This lesson takes approximately 2½ hours to complete.

LESSON FILES

Media Files:

None

Starting Files:

Lesson06/Assets/object1.fla

Lesson06/Assets/class1.fla

Lesson06/Assets/objectProject1.fla

Lesson06/Assets/registerClass1.fla

Completed Projects:

object2.fla

class4.fla

objectProject4.fla

registerClass2.fla



Macromedia Flash MX ActionScripting Advanced. Training from the Source
Macromedia Flash MX ActionScripting: Advanced Training from the Source
ISBN: 0201770229
EAN: 2147483647
Year: 2002
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net