PDA

View Full Version : Multiple arguments Error...



AjitpalS
February 12th, 2009, 01:31 AM
I'm trying to use multiple arguments in the flash but it is giving error



function average(...args):Number{
var sum:Number = 0;
for (var i:uint = 0; i < args.length; i++) {
sum += args[i];
}
return (sum / args.length);
}
trace(average(10,20,30));


It is giving error like this


Parameter name expected


could you tell me where i'm wrong (I'm using flash cs4)..................

TheCanadian
February 12th, 2009, 01:57 AM
Works for moi.

Krilnon
February 12th, 2009, 02:11 AM
It works for me in CS4 as well (just in case TheCanadian was using something else).

TheCanadian
February 12th, 2009, 02:14 AM
Flash 9 Alpha baby!

Krilnon
February 12th, 2009, 02:18 AM
So that's how you're doing it. I've been wondering about this for years. If I remember correctly, the splash screen for that is really hacked together, right?

TheCanadian
February 12th, 2009, 02:40 AM
I don't remember. I usually just leave it open. I'll tell you next time I close an re-open it.