Publishers of technology books, eBooks, and videos for creative people
ActionScript 3 offers a great solution to ensuring that your method parameters have values even when no values are passed. The solution is called default parameter values, which allow you to predefine default values for specific method parameters.
Default parameter values are useful for many reasons. Say you have a method that is used numerous timesm and it usually receives the same value for a specific parameter with one or two exceptions. It can get a little annoying to add the same value to a method call over and over. Setting a default value, if no value is passed, can easily prevent this annoyance.
In the following example, the addNumbers method has a default parameter value for the Boolean named rounded. In this case, the default value is false because we have decided that we would like to have the option to round the result, but do not need to round the result every time.
There are a ton of reasons why default parameters are useful, feel free to share yours...