View comments | RSS feed

Running subsequent examples

Now that you've developed and run the "Hello World" ActionScript 3.0 application, you should have the basic knowledge you need to run the other code examples presented in this manual.

Subtopics

Testing in-chapter example code listings
Working with end-of-chapter examples

Testing in-chapter example code listings

As you're working through this manual, you may want to try out the example code listings that are used to illustrate the various topics. That testing may involve displaying the value of variables at certain points in the program, or it may involve viewing or interacting with on-screen content. For testing visual content or interaction, the necessary elements will be described before or within the code listing--you'll just need to create a document with the elements as described in order to test the code. In the case where you want to view the value of a variable at a given point in the program, there are a few ways you can accomplish this. One way is to use a debugger, such as the ones built into Flex Builder and Flash. For simple testing, however, it might be easiest to just print variable values out to some place where you can view them.

The following steps will help you create a Flash document that you can use for testing a code listing and viewing variable values:

To create a Flash document for testing in-chapter examples:

  1. Create a new Flash document and save it on your hard drive.
  2. To display test values in a text field on the Stage, activate the Text tool and create a new Dynamic text field on the Stage. A wide, tall text field with the Line type set to Multiline and the border turned on will be most useful. In the Property inspector, give the text field an instance name (for example "outputText"). To write values into the text field, you will add code that calls the appendText() method to the example code (described below).
  3. Alternatively, you can add a trace() function call to the code listing (as described below) to view the results of the example.
  4. To test a given example, copy the code listing into the Actions panel; if necessary, add a trace() function call or add a value to the text field using its appendText() method.
  5. From the main menu, choose Control > Test Movie to create a SWF file and view the results.

Since this approach is for viewing values of variables, there are two ways that you can easily view the values of variables as you're trying out the examples: write values into a text field instance on the Stage, or use the trace() function to print values to the Output panel.

Working with end-of-chapter examples

Like this chapter, most chapters in this manual include a significant end-of-chapter example that ties together many of the concepts discussed in the chapter. However, unlike the Hello World example in this chapter, those examples will not be presented in a step-by-step tutorial format. The relevant ActionScript 3.0 code in each example will be highlighted and discussed, but instructions about running the examples in specific development environments won't be provided. However, the example files distributed with this manual will include all of the files you need to compile and run the examples easily in your chosen development environment.


Flash CS3

Take a survey


Comments


jmmp2006 said on Apr 23, 2008 at 4:30 AM :
Throughout this book there are references next to examples that "this will only work in Standard Mode" - however extensive searching does not reveal how one may "force" Standard Mode, in order to follow the examples.
Perhaps this page would be an intuitive place to make a note about modes?
jmmp2006 said on Apr 29, 2008 at 2:15 AM :
In reply to my earlier comment. In the Flash environment - see:
File>Publish Settings>ActionScript dialogue
where there is an option for selecting Mode.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000036.html