Re: [Flashcoders] Quick syntax q: how to write a function that can receive an undefined number of parameters

2007-05-11 Thread Steven Sacks
public static function center():Void { var targetClip:MovieClip = MovieClip(arguments.shift()); var i:Number = arguments.length; while (i--) { arguments[i]._x = targetClip._x + (targetClip._width / 2); arguments[i]._y = targetClip._y + (targetClip._height / 2); } }

Re: [Flashcoders] Quick syntax q: how to write a function that can receive an undefined number of parameters

2007-05-11 Thread Steven Sacks
Even more optimized public static function center():Void { var targetClip:MovieClip = MovieClip(arguments.shift()); centerX:Number = targetClip._x + (targetClip._width / 2); centerY:Number = targetClip._y + (targetClip._height / 2); var i:Number = arguments.length; while (i--)

Re: [Flashcoders] Quick syntax q: how to write a function that can receive an undefined number of parameters

2007-05-11 Thread eka
Hello :) you don't limit your while loop instruction ? while ( --i -1) { } EKA+ :) 2007/5/11, Steven Sacks [EMAIL PROTECTED]: Even more optimized public static function center():Void { var targetClip:MovieClip = MovieClip(arguments.shift()); centerX:Number = targetClip._x +