ActionScript Annoyances (Part 1): Limitations on Default Parameter Values

Every time I encounter something in AS3 that annoys me, I'm going to compel myself to blog about it, with the hope that it will filter through the Internet ethos to the desk of some of the Flash Player engineers in San Francisco.

Can't use static constants as default values for function parameters

Example:

public class PropertyType {
public static const LISTING_RESIDENTIAL : String = "ListingResidential";
...
}

public function createSearch(propertyType : String = PropertyType.LISTING_RESIDENTIAL) : void {
...
}

Results in this compiler error:

1047: Parameter initializer unknown or is not a compile-time constant.

Of course the bigger complaint here might be that there are no enumerated types in ActionScript... but that's probably asking too much. :)