GotoFile>New Keyboard Shortcut: [command/ctrl + N]. This will open the New Document dialogue box.
Select ActionScript File from the Type: selection area. • Click the OK button to open the new file.
Note: You cannot manually draw any artwork in an .AS file. The only thing a .AS file contains is code.Adobe has made a concerted effort to turn ActionScript into a powerful language for all sorts of complex rich Internet applications; they have worked hard at making Flash Player a standard, their Adobe AIR Framework has become an interesting alternative to things like desktop widgets and browser-run online applications. But with all of the effort making ActionScript flexible and powerful enough to satisfy developers, they have alienated many entry-level designers. The learning curve for ActionScript 3.0 is significantly higher than that for ActionScript 2.0.
This tutorial will cover the basics of creating and linking the two files needed to access the full power of AS 3.0. This tutorial will not cover any of the functionality of ActionScript, and it will not explain any of the terminology. Its only purpose is to show how to begin setting up a Flash project. Keyboard shortcuts are shown with square brackets: [Macintosh keys first/PC keys second + OTHER KEYS IN UPPERCASE], menus are shown in italics, buttons are shown underlined, and code is shown in monospace.

Adobe has made a concerted effort to turn ActionScript into a powerful language for all sorts of complex rich Internet applications; they have worked hard at making Flash Player a standard, their Adobe AIR Framework has become an interesting alternative to things like desktop widgets and browser-run online applications. But with all of the effort making ActionScript flexible and powerful enough to satisfy developers, they have alienated many entry-level designers. The learning curve for ActionScript 3.0 is significantly higher than that for ActionScript 2.0.

This tutorial will cover the basics of creating and linking the two files needed to access the full power of AS 3.0. This tutorial will not cover any of the functionality of ActionScript, and it will not explain any of the terminology. Its only purpose is to show how to begin setting up a Flash project. A print version is available in PDF format.

1. Prepare the workspace.

  • Go to Window > Workspace > Developer. This will arrange the Panels so that those needed for coding are most prominent.

2. Create a new .AS file

  • Go to File > New. Keyboard Shortcut: [command/ctrl + N]. This will open the New Document dialogue box.
  • Select ActionScript File from the Type: selection area. • Click the OK button to open the new file.

Note: You cannot manually draw any artwork in an .AS file. The only thing a .AS file contains is code.

3. Set up a package

  • Type package into the Developer Panel on line 1.
  • Type { an open curly bracket on line 1 to open the package.
  • Type } a closed curly bracket on line 3 to close the package.

Note: There are many great books available explaining the meaning behind most of the seemingly strange necessities of ActionScript, and it is advisable that you look through some of them. But one excellent piece of advice for a beginner is to absorb the basics by rote memorization.

flashTut_package

4. Set up a class

  • Type import flash.display.MovieClip; on line 3 to enable the class to function properly.
  • Type public class Example extends MovieClip on line 5.
  • Type { on line 5 to open the class.
  • Type } on line 7 to close the class.

Note: The name of you class is important because it will be used as the name of the file as well as the name of the constructor function. Give it a name that relates to what it is doing, in this case, Example.

flashTut_class

5. Set up the constructor function

  • Type public function Example () on line 7.
  • Type { on line 7 to open the function.
  • Type } on line 9 to close the function.

Note: Make certain the name of the Constructor, in this case Example, matches the name of the class character-for-character.

flashTut_constructor

6. Save the .AS file

  • Go to File > Save. Keyboard Shortcut: [command/ctrl + S].
  • Choose a location on your computer to save the file.
  • Type the name of the class into the Save As: textbox.
  • Click on the Save button.

7. Create a new .FLA file

  • Go to File > New. Keyboard Shortcut: [command/ctrl + N]. This will open the New Document dialogue box.
  • Select Flash File (ActionScript 3.0) from the Type: selection area.
  • Click the OK button to open the new file.

Note: Because all of the changes in the flash movie are made in the Example.as file, you should leave the Main Timeline empty and avoid adding any code through the Actions Panel.

8. Save the .FLA file

  • Go to File > Save. Keyboard Shortcut: [command/ctrl + S].
  • Choose the same location on your computer to save the .FLA file as you chose for the .AS file.
  • Type a meaningful name into the Save As: textbox.
  • Click on the Save button.

9. Link the .AS file to the .FLA file

  • Type the name of the class, in this case Example, into the Class: textbox in the Properties Panel.
  • Go to File > Save. Keyboard Shortcut: [command/ctrl + S].

flashTut_link


Leave a Reply

You must be logged in to post a comment.