Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

  • Print
  • + Share This
This chapter is from the book

Using Comments

After you have built a strong vocabulary of Flash actions and are constructing complex statements in the Actions panel, you should include remarks in your scripts to remind yourself and your collaborators of the goals of the ActionScript. Comments help you keep things straight as you develop intricate interactivity and relationships among objects (Figure 3.57).

Figure 3.57Figure 3.57 Comments interspersed with ActionScript statements help make sense of the code.

To create a comment:

  • In the Actions panel, choose Actions > Miscellaneous Actions > comment, and enter your comments in the Comment field of the Parameters pane.

    or

    In Expert mode only, type two slashes (//) in the Actions list, and enter your comments after the slashes.

    Comments appear in a different color from the rest of the script, making them easy to locate.

    Tips

    • If you have a long comment, break it up with multiple comment statements. That way, you'll have separate lines, and you won't have to scroll the Script pane to see the end of a long remark.

    • If you have a long comment spanning multiple lines, you can use a slash and an asterisk (/*) to mark the beginning and end of a comment block. For example:

      /* This begins the comment.
      Even text in between is considered part of the comment.
      /* This is the end of the comment.
    • Don't worry about creating too many comments. Comments are not compiled with the rest of the script, so they won't bog down performance. Also, because they aren't included in the exported .swf file, they don't increase the final file size.

    • The slash convention for creating comments in ActionScript is the same for creating them in keyframes. When you label a frame in the Property Inspector, begin with two slashes (//) to indicate a comment rather than a label (Figure 3.58).

      Figure 3.58Figure 3.58 In the Property inspector, double slashes indicate a comment in a Frame label.

  • + Share This
  • 🔖 Save To Your Account