Flash CS4 ActionScript 3.0 Tutorial


How to Add Comments to Flash ActionScript Code



Comments are a handy way to write code notes for future reference. There are various ways to write comments; single line comments or multiple line comments.


Step One

Open a new Flash document and name the default layer, Actions.

Step Two

Option double-click (PC - Alt double click) the first keyframe of the Actions layer to open the ActionScript panel.

Step Three

Copy/Paste the following code in the ActionScript Panel:

//Single line comment

stop(); //Single line comment


Multiple line comment. This comment can continue for

several lines


Dissecting the Code

You would use the first example of commenting for a short one line comment. You can also add your comment after some existing code. The last example would be used if your comment required several lines.

Other Ways to Comment

In this example we simply typed the comment symbols (//, /* and */). Another option is to highlight the code to be commented and click the Apply Block Comment or Apply Line Comment buttons at the top of the Actions panel. You can also highlight the code, then right-click and choose Apply /* */ Comment or Apply // Comment from the menu.


Contribute Ad