beautypg.com

Use syntax coloring, Using the identifier and keyword list at runtime, Use line numbers and word wrap – Adobe Flash Professional CC 2014 v.13.0 User Manual

Page 683

background image

To the top

To the top

To the top

You can type these comment markers manually, or you can use buttons at the top of the Actions panel or Script window to add them.

Comment a line of code

1. Place the insertion point at the beginning of the line or at the character where you want the comment to begin.

2. Right-click and select Comment. You can also use the keyboard shortcuts Ctrl + M (Windows) or Command + M or go to Edit > Comment

Selection.

A double slash (//) is placed at the insertion point.

Comment multiple lines of code

1. Select the lines to comment. (The first and last lines of the selection can be partial lines.)

2. Right-click and select Comment. You can also use the keyboard shortcuts Ctrl + M (Windows) or Command + M or go to Edit > Comment

Selection.

Block comment characters are placed at the beginning (/*) and end (*/) of the selection.

Note: If there are comments in between the selected lines of text, a line comment will be applied on all selected lines.

Remove a comment

1. Place the insertion point in the line that contains the comment, or select the block of code that is commented.

2. Right-click and select Uncomment. You can also use the keyboard shortcuts Ctrl + Shift + M (Windows) or Command + Shift + M or go to

Edit > Uncomment Selection.

Use syntax coloring

In ActionScript, as in any language, syntax is the way elements are put together to create meaning. If you use incorrect ActionScript syntax, your
scripts cannot work.

To highlight syntax errors, set a color-code for parts of your scripts. For example, suppose you set the syntax coloring preference to make
keywords appear in blue. When you type var, the word var appears in blue. However, if you mistakenly type vae, the word vae remains black,
which shows that you made a typing error.

Do one of the following:

Select Edit > Preferences (Windows) or Flash > Preferences (Macintosh), click Code Editor in the Category list, and specify Syntax Coloring
settings.

With the insertion point in the Script pane, press Control-U (Windows) or Command-U (Macintosh).

Note: When you write scripts in the Actions panel, commands that are not supported by the version of the player you are targeting appear in
yellow in the Actions toolbox. For example, if the Flash Player SWF file version is set to Flash 7, ActionScript that only Flash Player 8 supports
appears in yellow in the Actions toolbox.

Using the identifier and keyword list at runtime

On launching FlashPro, the identifier and keyword lists are read from the resource file and cached. Apart from reading the default lists from the
resource, it also scans for additional keywords and identifier list in the Preference folder. It is possible for you to add additional keywords and
identifiers by adding ".txt files" in following folders:

C:\Users\[AppData]\Roaming\Adobe\Flash Pro\13.0[ActionscriptKeywords]\

C:\Users\[AppData]\Roaming\Adobe\Flash Pro\13.0[ActionscriptIdentifiers]\

C:\Users\[AppData]\Roaming\Adobe\Flash Pro\13.0[JavascriptKeywords]\

C:\Users\[AppData]\Roaming\Adobe\Flash Pro\13.0[JavascriptIdentifiers]\

Use line numbers and word wrap

When you edit or modify code, line numbers make code easier to scroll and parse. Word wrap helps you avoid horizontally scrolling long lines of
code (especially when you work in the authoring environment, or at low screen resolutions).

Enable or disable line numbers

In the Script window, select View > Line Numbers.

Press Control+Shift+L (Windows) or Command+Shift+L (Macintosh).

Highlight a specific line

676