EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Formatting Actionscript Syntax

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
764 Best Practices and Coding Conventions for ActionScript 2.0
Formatting ActionScript syntax
Formatting ActionScript 2.0 code in a standardized way is essential to writing maintainable
code, and its easier for other developers to understand and modify. For example, it would be
extremely difficult to follow the logic of a FLA file that has no indenting or comments, as well
as inconsistent naming conventions and formatting. By indenting blocks of code (such as
loops and
if statements), you make the code easy to read and debug.
For more information on formatting code, see the following topics:
“General formatting guidelines” on page 764
“Writing conditional statements” on page 767
“Writing compound statements” on page 768
“Writing a for statement” on page 769
“Writing while and do..while statements” on page 770
“Writing return statements” on page 770
“Writing switch statements” on page 770
“Writing try..catch and try..catch..finally statements” on page 771
About using listener syntax” on page 772
General formatting guidelines
When you use spaces, line breaks, and tab indents to add white space to your code, you
increase your codes readability. White space enhances readability because it helps show the
code hierarchy. Making your ActionScript 2.0 easier to understand by making it more
readable is important for students as well as for experienced users working on complex
projects. Legibility is also important when you are debugging ActionScript code, because it is
much easier to spot errors when code is formatted correctly and is properly spaced.
You can format or write a piece of ActionScript 2.0 code several ways. You’ll find differences
in the way developers choose to format the syntax across multiple lines in the ActionScript
editor (the Actions panel or Script window), such as where you put brackets (
{}) or
parentheses [
()]).

Table of Contents

Related product manuals