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