Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


Don't use Auto Format with ActionScript 3 in Flash CS3

Posted May 23, 2007 by senocular

Just don't. Chances are if you do, you're script will get rewritten in a way that will break it. You may have remembered auto format doing some crazy things in the past like removing continue statements. Well, it hasn't gotten much better. Here are some quick examples:
// loses indent
var f:Function = function():void {

// adds extra semicolon and new line
var str = "\"quote\"";

// places class line at bottom of script
// and puts a semicolon after the { following MyClass
package {
public final class MyClass {

// (in an AS file with no FLA open)
// removes parens changing order of ops
x = (a - b)/c;

Whenever possible, simply avoid Auto Format.