AS 3 does not support method overloading.. but it gives a ...(rest) parameter as a nice way to do that. This parameter allows you to specify an array parameter that accepts any number of comma- delimited arguments. public static function getParams(... paramsArr):Number{ trace(paramsArr.length); } Unless you use the rest parameter, AS3 creates in memory a special object called arguments, which is an array that include references to each of the arguments and a reference to function itself (arguments.callee). AS3 allows you to call a function with more parameters than were included in the function declaration, and each of the parameters can be access by using the arguments notation. So, the difference between the rest parameter and arguments object is that it does not provide functionality similar to that provided by arguments.callee.
|
My Blog Title
|