How to Add ActionScript

Adding ActionScript code to your Flash project will let you create a wider variety of different features than you can with just the Flash designer interface. Adding just a few lines of ActionScript code will let you add mouse interactivity. Not only that, ActionScript code will let you add dynamic text to your games, letting you display different text message when game players select different game pieces and options. Getting started with ActionScript requires that you know how to open up the Actions editor, enter code into the editor, use the the Actions editor's menu functions and test your code.

Things You'll Need

  • Adobe Flash Professional (CS3, CS4 and CS5 versions)
Show More

Instructions

    • 1

      Start the Flash program. Click New from the File menu on the main Flash menu bar. Click the file type Flash File (ActionScript 3.0) from the New Document dialog box that appears. Click the OK button on the lower right hand side to close this dialog box.

    • 2

      Select the Actions option from the Window menu on the main Flash menu bar to open the Actions editor. Position your mouse cursor on the first line (labeled 1) of the Action's editor. Click your mouse button. Type on this line this code: trace("my first line of code")

    • 3

      Click the "blue checkmark" icon on the main Actions editor menu bar (tool tip: Check Syntax) to have Flash check that the code was entered in correctly. Read the message in the error dialog box that appears. Note if it reads "the script contains no errors" or "the script contains errors."

    • 4

      Click the OK button in the error dialog box. Go the next step if the script contains no errors. Read the errors listed in the Compiler Errors Panel if the script contains errors, then click on "error message" in the Compiler Errors Panel. Find the typing error in the first line of code and correct it if there are errors. Click the Check Syntax icon again to check if there any more errors. Repeat this process until the script contains no errors.

    • 5

      Click the "TestMovie" option in the Control menu on the main Flash menu bar. Read the statement you traced -- "my first line of code" -- that appears in the Output display panel.

Learnify Hub © www.0685.com All Rights Reserved