Case sensitivity

In a case-sensitive programming language, variable names that differ only in case (book and Book) are considered different from each other. Therefore, it's good practice to follow consistent capitalization conventions, such as those used in this manual, to make it easy to identify names of functions and variables in ActionScript code.

When you publish files for Flash Player 7 or later, Flash implements case sensitivity whether you are using ActionScript 1 or ActionScript 2.0. This means that keywords, class names, variables, method names, and so on are all case sensitive. For example:

// In file targeting Flash Player 7
// and either ActionScript 1 or ActionScript 2.0
//
// Sets properties of two different objects
cat.hilite = true;
CAT.hilite = true;

// Creates three different variables
var myVar:Number=10;
var myvar:Number=10;
var mYvAr:Number=10;
// Does not generate an error
var array:Array = new Array(); 
var date:Date = new Date();

This change also affects external variables loaded with LoadVars.load().

Case-sensitivity is implemented for external scripts, such as ActionScript 2.0 class files, scripts that you import using the #include command, and scripts in a FLA file. If you encounter runtime errors and are exporting to more than one version of Flash Player, you should review both external script files and scripts in FLA files to confirm that you used consistent capitalization.

Case-sensitivity is implemented on a per-movie basis. If a strict Flash Player 7 application calls a non-strict Flash Player 6 movie, ActionScript executed in the latter movie is non-strict. For example, if you use loadMovie() to load a Flash Player 6 SWF into a Flash Player 7 SWF, the version 6 SWF remains case-insensitive, while the version 7 SWF is treated as case-sensitive.

When syntax coloring is enabled, language elements written with correct capitalization are blue by default. For more information, see Keywords and reserved words and Syntax highlighting.


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00000760.html