In post topics and default variables in Javascript, Actionscript and PHP I was exposed using the techniques of parameter passing and default variables. Add, now, that in ActionScript 3.0 introduces a new parameter declaration can specify an array parameter that accepts any number of arguments separated by commas: ... (rest ... (rest )
1 2 3 4 5 6 7 8 9 10 |
This technique does not replace the use of the object arguments , but is useful in the class declarations in the absence of parameters where Actionscript generates an error. Furthermore, as mentioned in the manual:
The parameter (rest) can have any name that is not a reserved word and should be the last parameter specified. The use of this parameter makes the object unavailable
arguments. Even if the parameter... (rest)e della proprietàarguments.length, non fornisce invece una funzionalità simile a quella diarguments.callee.... (rest)offers the same functionality as theargumentsand propertyarguments.length, does not provide functionality similar to that ofarguments.callee. Before using the parameter... (rest).... (rest), make sure you do not need to usearguments.callee.
You can also use this technique together with the declarations are:
1 2 3 4 5 6 7 8 9 | a : String , b : int , ... mioarr ) { sampleFunction function (a: String , b: int , ... mioarr) { var i : uint = 0 ; i < mioarr . length ; i ++ ) trace ( args [ i ] ) ; for (var i: uint = 0; i <mioarr. length; i + +) trace (args [i]); } , 16384 , 128 ) ; sampleFunction (4096, 16384, 128); / / Output: / / 16384 / / 128 |










There are no comments for this post
Leave a comment