Home Home
inset
With years of experience in enterprise software, we offer web development services built on leading industry standards.

How to use varargs in Flex with Actionscript

Variable Arguments, or Varargs as they are commonly known, allow you to pass zero or more arguments of a data type to a function. The advantage being that the function does not need to have a fixed number of arguments in its method signature.

Sample Code

The following example uses Varargs to return the total of a series of numbers.


private function sum(... nums):Number {
var total:Number = 0;

	for(var i:int = 0; i < nums.length;i++){
		total += nums[i];
	}

return total;
}

icon right

How to contact us

If you are interested in a website or have any queries please contact us.

Phone : +44 (0)7793 131709

E-Mail : enquiries@limeliteweb.co.uk