Categories
ActionScript

Case sensitivity

One of the new features in Flash MX 2004 and the new Flash Player 7 is ActionScript case-sensitivity. Case-sensitivity is enforced only if the movie is published for Flash Player 7, and is not related to whether it is ActionScript 1.0 or 2.0.

For example, a Flash MX 2004 movie set to use ActionScript 2.0 and published to Flash Player 6, is not case-sensitive: swfoo and swFOO are the same.

On the other hand, a movie set to use ActionScript 1.0 and published to Flash Player 7 is case-sensitive: swfoo is different from swFOO.

So case-sensitivity is determined by the Flash player setting, not the version of ActionScript used. Thanks to Chafic Kazoun for the tip.

One reply on “Case sensitivity”

There seems to be a bug with Flash Player 7, however. Movies created with MX 6 should be treated by FP7 as case-insensitive, but are not. The same applies to movies created with 04 and published to FP6/AS1.

Below is an example — if there is something wrong, please let me know. We’ve submitted a bug to MM, but would love to know more about this issue. Thanks!

This example was created and published from Flash MX Version 6:

// _global.CountryPK = function() { }
// either constructor shows the issue
function CountryPK() {}
CountryPK.prototype.countryid = “ABC”;

var cPK = new CountryPK();
cPK.COUNTRYID = “USA”;

var text;
for (var attr in cPK) {
line = attr+”=”+cPK[attr];
text += line + “n”;
}

out_txt.text = text;
trace(text);

when running from Flash Player 6:
COUNTRYID=USA

When running from Flash Player 7:
countryid=USA
COUNTRYID=USA

The bug is that the cPK object instance ends up with two attributes having the same value. If case was insensitive, the second should overwrite the first.

Leave a Reply to Tom Wilcoxen Cancel reply

Your email address will not be published. Required fields are marked *