The usage is so simple and clear. Using this operator we can pass n number of variables values and hold them for calculation.The variable can be of any type and the final args contains the array of elements we pass.the below example will make you clear.
Flex Code Example:
CreationComplete=”init()” –>Call this on Application creation.
scrpt Code
private function init():void
{
lbl.text=String(average(100,100,100,100,100));
}
private function average(… args):Number
{
var sum:Number=0;
var i:int;
for(i=0;i<args.length;i++)
{
sum+=args[i];
}
return sum/args.length;
}
MXML code
<mx:Label id=”lbl” />
Enjoy the Post and Operator. Make your code simple.
