User Guide
298 Chapter 6: Components Dictionary
Parameters
index
A number greater than or equal to 0. This number is the index of the item to change.
item An object that is the new item.
Returns
Nothing.
Description
Method; replaces the content of the item at the specified index. This method triggers the
modelChanged event with the event name removeItems.
Example
This example replaces the item at index 3 with the item labeled “new label”:
myDP.replaceItemAt(3, {label : "new label"});
DataProvider.sortItems()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
myDP.sortItems([compareFunc], [optionsFlag])
Parameters
compareFunc
A reference to a function that compares two items to determine their sort order.
For details, see
Array.sort() in Flash ActionScript Language Reference.This parameter
is optional.
optionsFlag Lets you perform multiple, different types of sorts on a single array without
having to replicate the entire array or resort it repeatedly. This parameter is optional.
The following are possible values for
optionsFlag:
• Array.DESCENDING, which sorts highest to lowest.
• Array.CASEINSENSITIVE, which sorts case-insensitively.
• Array.NUMERIC, which sorts numerically if the two elements being compared are numbers. If
they aren’t numbers, use a string comparison (which can be case-insensitive if that flag is
specified).
• Array.UNIQUESORT, which returns an error code (0) instead of a sorted array if two objects in
the array are identical or have identical sort fields.