DevelopPHP
home Forum gear home

Libraries book

HTML Library CSS Library JavaScript Library PHP Library

Videosbook

PHP and MySQL JavaScript HTML and CSS Vector and 3D Flash Actionscript Android Dev Miscellaneous

Resourcesbook

Website Hosting
Using the rest( ... ) Operator for Argument Arrays   Share / Like
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
Home   •   Terms of Use   •   Developer Forums   •   T-Shirts   •   RSS   •   Classroom Chalkboard   •   Donate   •   Top ↑
Popular In PHP / MySQL E-Commerce Store Production
Social Network Website Building
Image Upload / Photo Processing
CMS Software Programming
Mass Email Systems
Magic XML Data
Search Programming
Popular In JavaScript JSON Programming
Ajax Programming
Animating Elements
WYSIWYG Programming
Date/Time Programming
DOM Scripting
Object Reference
Popular In HTML Canvas Element
New Form Elements
Audio Element
Video Element
Drag and Drop
Event Handling
Element Grouping
Popular In CSS Custom Font Embedding
Dynamic Fit Backgrounds
Theatre Mode
Box Overlays
CSS Level 1 Properties
CSS Level 2 Properties
CSS Level 3 Properties
©2013 DevelopPHP   |   Navigate to related domains HTML5