May 3, 2009 at 13:58[AS3] Using the … argument

This argument is very useful. You can type it as Array. It can’t be null :

function pouet(... args:Array):void {
    trace("pouet [", args.length, "]", args);
}

// pouet [ 4 ] pouet,tagada,tsoin,tsoin
pouet("pouet","tagada","tsoin","tsoin");
// pouet [ 4 ] pouet,tagada,,tsoin
pouet("pouet","tagada",null,"tsoin");
// pouet [ 4 ] pouet,tagada,,
pouet("pouet","tagada",null,null);
// pouet [ 4 ] ,,,
pouet(null,null,null,null);
// pouet [ 0 ]
pouet();
Written by Rémi.T under Coding.
Tags: .
Add a comment »

No Comments

Leave a comment