I posted about it almost a year and a half ago, but I figured I'd wait until official release to see if there was any change from early public beta, but alas -- no.
If you specify a function parameter to have a default value (which, according to the documentation "effectively makes that parameter an optional parameter") you can't skip it in a function call. (Side note - other languages allow either skipping the parameter just by empty commas, empty double-quotes, or by have a system constant to use in a skipped parameter's place -- see previous post for more info)
Example:
function testFunc(x:int, y:int = 10, z:int = 20) {
trace(x,y,z);
}
testFunc(50,,12);
That won't work.
I suppose the wording in the AS3 documentation is just a little misleading (if you know how other languages handle optional params, but maybe not if AS is the only language you know):
"If a call to a function with default parameter values omits a parameter with default values, the value specified in the function definition for that parameter is used." (emphasis mine)
In practice it seems that you either have to omit ALL optional parameters, or fill in the default values (if you know them) up to the parameter you want to use a non-default value for; you can't just omit "a parameter" if it's in the middle of the bunch.
So - a year and a half later, does anyone know if there IS a way to do this? Documented somewhere? Undocumented?
Not going to lose sleep over it, but it would be awesome to have.
g.
ps - LOVING the Suite. Nice to have Photoshop and Illustrator included... no more having to buy a suite and separate upgrades (except for my wife's copy of Photoshop)
The opinions expressed on this blog are those of the author only and are not necessarily those of his employer.
