ActionScript Fundamentals pt. 1 / About Objects / Classes & Properties
Subtitles of the Movie
Now that you've successfully written your first script let's back up a bit so I can provide some theory and structural information about ActionScript 3.0. This will help you better understand the scripts that we'll be working with as we move forward. Later on after you have more experience writing scripts I'll pause again in our script writing to give you more ActionScript theory and structural information. ActionScript is a kind of Object-Oriented Programming language, also abbreviated OOP, though technically it's considered a scripting language rather than a full-fledged programming language. OOP is a type of programming that allows you to work with complex applications by breaking those applications into smaller self-contained structures or objects. Those objects have intrinsic properties and methods, also referred to as Actions. Now to successfully work with any OOP language you need to have a solid understanding of Classes and Objects. Classes are absolutely essential to ActionScript 3.0. Classes are the blueprint or template for objects of that class. The key term here is template. You use a template to create many copies of an original. In every day terms a person could be considered an object. There are many persons in the world and they all come from a larger group known as the human race. In this example the human race would be our class and an individual person would be an object of that class. While individual persons or objects are different from one another the kinds of characteristics and abilities are limited by those available to the human class. Let's look at that in some more detail by examining an individual person. Now Flash provides classes for you to use in your movies or you can even create your own custom classes. Built-in classes help you deal with data such as the math class or the Array class, or media such as the sound and video classes. Here's an example of a class. I'm creating a new class object, mySound based on the sound class. Notice that the new Sound is in blue; that's a reserved term identifying this built-in class that comes with ActionScript, a sound. Now in much the same way that a person has certain characteristics such as sex, height, weight, eye color and so forth, an object can also have properties. A person does not have a tail length, that property would belong to a different kind of class such as a cat class or a dog class. Here's another sample script. MovieClip.alpha equals 40. In this line of code we're setting the Alpha, or the transparency of a movie clip named myMovieClip to 40 percent. You may notice that if you know ActionScript 2.0 that in ActionScript 3.0 the underscore here for identifying the properties is no longer needed. So to summarize, Object-Oriented Programming is a type of programming that allows you to work with complex applications by breaking those applications into smaller, self-contained structures or objects. Classes are templates for creating objects that share the same characteristics and properties are attributes of objects that can be manipulated with code. Let's now move on to the next movie and review methods, which are predefined functions that are part of a class.
Tutorial Information
| Course: | Adobe Flash ActionScript 3.0 for Designers |
| Author: | James Gonzalez |
| SKU: | 34060 |
| ISBN: | 1-935320-82-3 |
| Release Date: | 2009-11-09 |
| Duration: | 9.5 hrs / 101 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 