Alex:

The error was actually in my next line of code however the debugger wasn't stopping at the right line. Silly me.

The code works fine.

Thanks,
Patrick

Yeah, the error was on the next
On Mar 26, 2007, at 10:51 AM, Alex Harui wrote:


This compiles and runs for me.



private function init():void

{

            function randomSort(a, b) {

            return Math.random()>.5 ? -1 : 1;

            }



            var numbers:Array = new Array();



            for (var n:int=0;n<10;n++){

            numbers[n] = n;

            }

            numbers.sort(randomSort);

            trace(numbers);

}



From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of {reduxdj}
Sent: Saturday, March 24, 2007 11:25 PM
To: [email protected]
Subject: [flexcoders] Randomizing Array (from actionscript cookbook3 and other places)



I am getting an error with the following code

TypeError: Error #1006: value is not a function.
at com.me.data::PictureProviderXML/::handleComplete()


function randomSort(a, b) {
return Math.random()>.5 ? -1 : 1;
}

var numbers:Array = new Array();

for (var n:int=0;n<photos.length;n++){
numbers[n] = n;
}
numbers.sort(randomSort);

any ideas, it looks like I am using this properly any ideas?

Thanks,
Patrick





Reply via email to