Even if Adobe has already carved in stones what the next iteration of the ActionScript language will contain, I think it’s worth that each of us Flash developers shout out what we would like to see in the upcoming AS4.

Perhaps some things should be taken out; Surely some features and/or keywords needs to be added to be on par with other popular programming languages (such as Java, C/C++/C#, etc).

Syntax / Language Features:

  • Add keyword abstract, to indicate superclasses that MUST be subclassed and cannot be instantiated directly;
  • Constructors can be private (Real Singletons, please!)
  • More forgiving casting over primitive data types (implicit casting?);
var label:TextField = new TextField();
label.text = 13;
  • Compile-time Macro functions (based on Joa Ebert’s examples);
  • Operator Overriding (ex: replace add/removeEventListener with +=, -=); += onButtonClicked;
function onButtonClicked(e:Event):void {
  trace("You clicked: " +;
  Button( -= onButtonClicked;
  • Namespace works like C# (multiple and nested);
  • Accessors can declare methods and properties as a group;
class HelloWorld {
    var one:int = 1;
    var two:int = 2;

    var hello:String = "foo";
    var world:String = "bar";
  • Variable Instantiation shorthand (ex: var location:Point()  );
  • Getters and Setters shorthand declarations;
class GetterSetterExample {
  private var _text:String;
    function text() {
      get { return _text; }
      set { _text = value; } //'value' is the default argument for setters
  • Strictly-typed Advanced Dictionaries (like Java Generics, thanks for the suggestion Nisse Bergman!);
var myBitmapList:Dictionary<Bitmap,Rect>();

var key:Bitmap = myBitmapList.keys[0];
var value:Rect = myBitmapList[key];
  • Access to previous calling Function & Arguments;
function foo(a:int, b:int):void {

function bar():void {
  trace(arguments.caller.arguments[0] + arguments.caller.arguments[1]);

foo(1,2); //traces "3"
  • Remove ‘with’ keyword;
  • Scope access for Code Optimization (at compile-time);

Calling Methods with Named Parameters

I think this one closely resembles the way that Objective C uses the notion of “Messages ” for triggering methods. A friend of mine (Martin Copp) brough up this as being an issue, especially when simply wanting to pass in multiple consecutive parameters with dynamic names in one single-line (instead of creating the object and assigning the parameters on their own separate lines). Have a look at the example below:

//Example: Method call with Named-Parameters:
function foo(pFirst:Boolean, pSecond:int, pThird:String) {
  trace([pFirst,pSecond,pThird].join(", "));

// * Traditional:
foo(true, 2, "three!");

// * Named Parameters:
foo(pFirst: true, pSecond: 2, pThird: "three!");

// ** Dynamically Named Parameters:
foo("pFirst": true, "pSecond": 2, "pThird": "three!");

// ** Dynamically Named Parameters (with concatenation):
var p:String = "p";
foo(p + "First": true, p + "Second": 2, p + "Third": "three!");

// ** Resolves Local vars as Named-Parameter:
var paramName1:String = "pFirst";
var paramName2:String = "pSecond";
var paramName3:String = "pThird";
foo(paramName1: true, paramName2: 2, paramName3: "three");

// ** Resolves Array-Elements as Named-Parameters (also concatenated):
var params:Array = ["pFirst", "pSecond", "p", "Third"];
foo(params[0]: true, params[1]: 2, params[2] + params[3]: "three!");

// * = Datatype checking at compile-time;
// ** = Datatype checking at run-time only;

This example may not specifically address the property “dynamicness” that he was referring to, but maybe creating a new DataType for messages would fix that, something like:

function foo( pMsg:Message.<ClassABC> ):void {
  trace([pMsg.first,pMsg.second,pMsg.third].join(", "));

class ClassABC {
  public var first:Boolean;
  public var second:int;
  public var third:String;

I just used the Vector’like syntax as an example, it wouldn’t necessarily have to use angle-brackets (< and >) as the declaration syntax. Got better ideas?

Overall Flash Player Features:

  • Multi-Threading (Yaye! AS Workers will do that!);
  • Stage3D Shared Geometry VertexBuffers;
  • Stage3D Drawing API (for lines, rects, circles, etc.);
  • Better Audio API for DSP development (with low / no latency);
  • No Text rendering glitches (especially in larger apps);
  • Replace Event system by Robert Penner’s AS3-Signals;

Of course, better debugging tools would always be appreciated (especially visual ones to traverse the execution stack during the course of a certain time).

If you guys agree, disagree, or would want to add some – add it to the comments below!

What’s inside your AS4 wishlist? ;)

Other Recommended Reading