Skip to Content
ActionScript for Flash MX: The Definitive Guide, Second Edition
book

ActionScript for Flash MX: The Definitive Guide, Second Edition

by Colin Moock
December 2002
Intermediate to advanced content levelIntermediate to advanced
1088 pages
192h 4m
English
O'Reilly Media, Inc.
Content preview from ActionScript for Flash MX: The Definitive Guide, Second Edition
Array.splice() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
452
|
ActionScript Language Reference
The sort order is indeterminate when multiple elements have the identical value for the key
property. In this case, sortOn() may produce inconsistent results between multiple calls.
For example:
function Contact (firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Contact.prototype.toString = function () {
return this.firstName + " " + this.lastName;
}
// Populate a contacts array with Contact instances that
// share identical lastName property values.
var contacts = new Array();
contacts[0] = new Contact("Makiko", "Pitaru");
contacts[1] = new Contact("Amit", "Pitaru");
contacts[2] = new Contact("Richard", "Clayton");
contacts[3] = new Contact("Derek", "Clayton");
// Sort by lastName...
contacts.sortOn("lastName");
trace(contacts); // Displays:
// Richard Clayton,Derek Clayton,Makiko Pitaru,Amit Pitaru
// Sort AGAIN by lastName...
contacts.sortOn("lastName");
trace(contacts); // Displays DIFFERENT RESULTS:
// Richard Clayton,Derek Clayton,Amit Pitaru,Makiko Pitaru
See Also
Array.sort()
Array.splice() Method
remove elements from, and/or add elements to, an array
Flash 5
array.splice(startIndex)
array.splice(startIndex, deleteCount)
array.splice(startIndex, deleteCount, value1,...valuen)
Arguments
startIndex The zero-relative ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ActionScript 3.0 Game Programming University, Second Edition

ActionScript 3.0 Game Programming University, Second Edition

Gary Rosenzweig
ActionScript 3.0 Bible

ActionScript 3.0 Bible

Roger Braunstein
ActionScript 2.0 Language Reference for Macromedia® Flash® 8

ActionScript 2.0 Language Reference for Macromedia® Flash® 8

Francis Cheng, Jen deHaan, Robert L. Dixon, Shimul Rahim

Publisher Resources

ISBN: 059600396XCatalog PageErrata