Hello All,
I hope you all are doing wonderfully today.
I am trying to create a custom Rolodex/VoIP caller type mini app for my desktop.
I am getting my data from my localhost database and returning all my contacts information as strings to an array.
I have tabs(buttons) at the top for First Name, Middle Name, Last Name.
The strings in the array look something like this:
“01, john, smith, john.smith@smithconstruction.com, 555-555-5050,true”
“02, jane, smith, jane.smith@itemp.com, 555-555-0006, true”
So forth and so on.
I have seen the Adobe help section using the following code:
var names:Array = new Array("John Q. Smith", "Jane Doe", "Mike Jones"); function orderLastName(a, b):int
{
var lastName:RegExp = /\b\S+$/;
var name1 = a.match(lastName);
var name2 = b.match(lastName);
if (name1 < name2)
{
return -1;
}
else if (name1 > name2)
{
return 1;
}
else
{
return 0;
}
}
trace(names); // output: John Q. Smith,Jane Doe,Mike Jones
names.sort(orderLastName);
trace(names); // output: Jane Doe,Mike Jones,John Q. Smith
But I want to be able to sort by any index in my string.
Anyone have any knowledge and or hints on how to go about this?
Thank you in advance for looking.
-James