beautypg.com

Compiling actionscript conditionally (cs5) – Adobe Flash Professional CC 2014 v.13.0 User Manual

Page 632

background image

To the top

To set the application-level classpath:

1. Choose Edit Preferences (Windows) or Flash > Preferences (Macintosh) and click the ActionScript category.

2. Click the ActionScript 2.0 Settings button and add the path(s) to the Classpath list

Set the source path for ActionScript 3.0

To set the document-level source path:

1. Select File > Publish Settings, and click Flash.

2. Verify that ActionScript 3.0 is selected in the ActionScript Version pop-up menu, and click Settings. Your Flash Player version must be set to

Flash Player 9 or later to use ActionScript 3.0.

3. Specify the frame where the class definition should reside in the Export Classes in Frame text field.

4. Specify the Errors settings. You can select Strict Mode and Warnings Mode. Strict Mode reports compiler warnings as errors, which means

that compilation will not succeed if those types of errors exist. Warnings Mode reports extra warnings that are useful for discovering
incompatibilities when updating ActionScript 2.0 code to ActionScript 3.0.

5. (Optional) Select Stage to automatically declare stage instances.

6. Specify ActionScript 3.0 or ECMAScript as the dialect to use. ActionScript 3.0 is recommended.

7. To add paths to the source path list, do any of the following:

To add a folder to the source path, click the Source path tab and then click the Browse To Path button

, browse to the folder to add,

and click OK.

To add a new line to the Source path list, click the Add New Path button. Double-click the new line, type a relative or absolute path,
and click OK.

To edit an existing Source path folder, select the path in the Source path list, click the Browse To Path button, browse to the folder to
add, and click OK. Alternatively, double-click the path in the Source path list, type the desired path, and click OK.

To delete a folder from the source path, select the path in the Source path list and click the Remove From Path button .

To set the application-level source path:

1. Choose Edit Preferences (Windows) or Flash > Preferences (Macintosh) and click the ActionScript category.

2. Click the ActionScript 3.0 Settings button and add the path(s) to the Source path list.

Set the Library path for ActionScript 3.0 files

To set the document-level Library path, the procedure is similar to setting the Source path:

1. Choose File Publish Settings and click the Flash tab.

2. Make sure ActionScript 3.0 is specified in the Script menu and click Settings.

3. In the Advanced ActionScript 3.0 Settings dialog box, click the Library path tab.

4. Add the library path to the Library path list. You can add folders or individual SWC files to the path list.

5. To set the Link Type property, double-click Link Type in the property tree of the path. The choices for Link Type are:

Merged into code: The code resources found in the path are merged into the published SWF file.

External: The code resources found in the path are not added to the published SWF file, but the compiler verifies that they are in the
locations you specified.

Runtime shared library (RSL): Flash Player downloads the resources at runtime.

To set the Application-level Library path:

1. Choose Edit Preferences (Windows) or Flash > Preferences (Macintosh) and click the ActionScript category.

2. Click the ActionScript 3.0 Settings button and add the path(s) to the Library path list.

Compiling ActionScript conditionally (CS5)

You can use conditional compilation in ActionScript 3.0 in the same way that it has been used in C++ and other programming languages. For
example, you can use conditional compilation to turn blocks of code throughout a project on of off, such as code that implements a certain feature
or code used for debugging.

Using config constants that you define in the publish settings, you can specify whether certain lines of ActionScript code are compiled or not. Each
constant takes the following form:

CONFIG::SAMPLE_CONSTANT

In this form, CONFIG is the config namespace and SAMPLE_CONSTANT is the constant that you will set to true or false in the publish settings.
When the value of the constant is true, the line of code that follows the constant in ActionScript is compiled. When the value is false, the line of

625