-- online Search!
Look, an author!

Commenting Your Code

by ilyas usal   | filed under Flash and ActionScript

TL;DR

Always comment your code, for yourself and for anyone else who reads it. Flash gives you two ways: // for a single-line comment and /* ... */ for a comment spanning as many lines as you want. Anything inside a comment won't run, which also makes comments useful for debugging.

  • The author writes comments describing everything he plans to do, including every function, before writing a single line of code.
  • Comments help when you return to modify something a year later or hand your FLA to someone else.
  • Commenting out sections lets you take out parts that might not work while you test the FLA.

Most of the best programmers on the world will tell you that: always comment on your code. For yourself and for the others. This is absolutely vital. Personally, before writing any line of code, I write in commentary everything I want to do. All the functions, and what they are doing.

It is a very good habit because it gives you a clear idea of what you have to do, if you want to modify something a year later, you'll be happy to know what all your functions do, and if you give your fla to someone, it will be a great help for him to understand it.

There are two ways to comment:

// This is a commentary, but it
// only works on 1 line.

And the other:

/* I can put as many things as I want,
on as many lines as I want */

Of course, any code put in there will NOT be executed. That's why it is also useful for debugging your code (you can try to take out parts that might not work in order to test the fla).

Before you go, here are a few things you can do:

  1. Ask a question

    Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.

Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy kirupa's books, became a paid subscriber, watch the videos, and/or interact on the forums.

Your support keeps this site going! 😇

- pom

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright © KIRUPA 2026 //--