Develop PHP Website for Learning Web Design Free Online
  Home   |   Forums   |   DevCMS
  Join   |   Log In
 
   

Actionscript 3.0 Tutorials - Learn Actionscript 3.0

Tutor at Develop PHP
Using the rest( ... ) Operator for Argument Arrays
By: Adam      Created: Jul 07, 2009      Views: 3032 Tweet This Page  Post page to Facebook  Post page to Facebook

ActionScript 3.0 sports a new feature called the rest( ... ) operator. This allows us to send a comma delimeted array of arguments to our custom functions for processing. The rest operator is represented by three consecutive dots called triple dot( ... ).

Using the rest operator to send array data into functions

Learn HTML
function myFunction(... argArray):void {
    
    for (var i:uint = 0; i < argArray.length; i++) {
        trace(argArray[i]);
    }
    
}
myFunction("Joe", "Betty", "Suzy", "William");

Develop PHP browser display window
Joe
Betty
Suzy
William


Using rest along with other arguments. (rest ... ) must come last.

Learn HTML
function myFunction(var1:String, var2:String, ... argArray):void {
    
    trace(var1 + " is first in line");
    trace(var2 + " is second in line");
    
    for (var i:uint = 0; i < argArray.length; i++) {
        trace(argArray[i]);
    }
    

}
myFunction("Joe", "Betty", "Suzy", "William");

Develop PHP browser display window
Joe is first in line
Betty is second in line
Suzy
William

                                   Properties of the Arguments List Array


Comment on Using the rest( ... ) Operator for Argument Arrays




Search Tags:
Using   ·  the   ·  rest(   ·  ...   ·  )   ·  Operator   ·  for   ·  Argument   ·  Arrays   ·  
 
 
Arbitrary Links and Archives
Home
Active Forums
Members
SIte News
Link To Us
Gear
2009 Forum Archive
Programming Courses
Learn HTML
Learn CSS
Learn PHP
Learn MySQL
Learn Javascript
Learn jQuery
Learn ActionScript 3.0
Learn Java
Learn XML
DevelopPHP Requires Flash Player
Get Adobe Flash player
___________________________________________

Terms of Use  •  Privacy  •  Admin Notes

©2010 developphp.com   |   Powered By FlashBuildingHolder