Example Shows How to Use Variable Parameters In Flex

By admin | December 18, 2008

Developers who have used C/C++ must knew intelligent using variable parameters could help us save a lot of time. In fact we could also use variable parameters in ActionScript. Then following is an simple function shows how to use it:


  1. private function sum(... nums):Number {
  2. var total:Number = 0;
  3.  
  4. for(var i:int = 0; i < nums.length;i++){
  5. total += nums[i];
  6. }
  7.  
  8. return total;
  9. }

Topics: Adobe-Flex | No Comments » | Tags: , ,

Search Posts

Sponsor Links