ActionScript 3 and Flash CS3 Professional

ActionScript 3 and Flash CS3 Professional
With this newest upgrade of FlashR CS3 Professional, the Flash ActionScriptTM scripting language has grown up into a full-fledged programming language. Of course, this is a two-edged sword. With the increase in functionality, ActionScript 3 is now much more complex.

As a programmer at OSU many years ago, I saw many of my coworkers rewrite their programs when a new language became popular. I never agreed with that practice. I never reinvent the wheel unless I absolutely need to. However, I think that when switching to ActionScript 3, you really do need to reinvent the wheel. I'm sure that you can find many quick fixes and work-arounds for patching your ActionScript 2 code to work in ActionScript 3. There are several books published for just that purpose. But, you will probably spend just as much time (or even more time) searching for those fixes and patching them into your programs than you would spend learning ActionScript 3 from the ground up. So here we go.

Most of you already know that ActionScript 3 is an Object-Oriented Programming language. So we will start by discussing some of the OOP basics such as objects, classes and properties while looking at the first line of code for creating a class.

. . .
public class name_of_class {
public var name_of_property . . .
}
. . .

Objects, Classes and Properties

An object is a "thing". It can be a movie clip or a snowflake. In a previous tutorial, we created a snowflake symbol and placed several instances of the symbol on the Flash stage. Each snowflake that we placed on the stage was an instance of the snowflake symbol that we stored in the Flash Library. You can think of an object as an instance of a class. Once you have created a class, you can use as many instances, or objects, of that class as you need. So what is a class?

An OOP class is a grouping of one type of object such as a movie clip. Each movie clip that you use in your Flash movie would be an instance or object of the MovieClip class. Why would you want to group all the movie clips into a class? Well, a class can have properties. A property is a type of variable that holds a piece of information. Any property that you give to your class is "passed down to" each instance of that class. For example, the MovieClip class has properties such as height, width and rotation which you can use to control how the movie clip appears on your stage.

Copyright 2018 Adobe Systems Incorporated. All rights reserved. Adobe product screen shot(s) reprinted with permission from Adobe Systems Incorporated. Adobe, Photoshop, Photoshop Album, Photoshop Elements, Illustrator, InDesign, GoLive, Acrobat, Cue, Premiere Pro, Premiere Elements, Bridge, After Effects, InCopy, Dreamweaver, Flash, ActionScript, Fireworks, Contribute, Captivate, Flash Catalyst and Flash Paper is/are either [a] registered trademark[s] or a trademark[s] of Adobe Systems Incorporated in the United States and/or other countries.





RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map








Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.