Game Development Reference
What's your directive?
The next bit of code that the program needs is a directive . One of the great pleasures of computer
programming is being able to bandy about terms like constructor method and directive as though you
were the captain of your own personal galactic cruise liner. Very simply, a directive is a single action
that you want the program to perform. Methods are made up of one or more directives, and with
them the program springs to life.
5. The directive you'll add to the constructor method will tell Flash to display the words “Hello
World!” in its Output window when the program runs. Add the following text in bold to your
pn]_a is a method built into the AS3.0 language that's used to send whatever is in parentheses to
Flash's output window. If you want to send the Output window some text, that text needs to be sur-
rounded by quotation marks. AS3.0 has lots of built-in methods, such as pn]_a, that you can use to
do all kinds of interesting things, and you'll be looking at many of them in detail over the course of
Directives end in a semicolon like this one:
The semicolon is a basic piece of punctuation that lets Flash know that “The directive is finished!” It's
like a period at the end of a sentence.
If you forget to add a semicolon at the end of a directive, Flash will still give you the
benefit of the doubt and assume that you intended to add one. Your program will
still run flawlessly without it. Thanks, Flash! But in the interest of good programming
style, you should always add a semicolon. If you go on to learn other programming
languages that aren't as lenient (and most aren't), you'll have already developed an