Are you new? Read the FAQ and catch up on!
1k views

Detect number of parameters of a Function

functionName.length tells you how many parameters a function has. This is an undocumented feature so use it carefully.

For instance:

ActionScript 3
  1. var callback:Function;
  2.  
  3. // ...
  4.  
  5. if (callback.length == 0)
  6.     callback();
  7. else if (callback.length == 1)
  8.     callback(someData);
  9.  

­

Tags: ActionScript 3.0 function

Embed: