Parameters
A number greater than 0 and less than
index
which to insert the item (the index of the new item).
A string that indicates the label for the new item.
label
The data for the item. This parameter is optional and can be of any type.
data
An object to use as the item, usually containing
itemObject
Returns
Nothing.
Description
Method; replaces the content of the item at the specified index.
Calling this method modifies the data provider of the List component. If the data provider is
shared with other components, those components are updated as well.
Example
The following example replaces the item at the currently selected position. To try this code,
drag a List component to the Stage and give it the instance name my_list. Next, drag a Button
component to the Stage and give it the instance name replace_button. Add the following
code to Frame 1 in the timeline:
var my_list:mx.controls.List;
var replace_button:mx.controls.Button;
replace_button.label = "Replace";
my_list.addItem({data:"flash", label:"Flash"});
my_list.addItem({data:"dreamweaver", label:"Dreamweaver"});
my_list.addItem({data:"coldfusion", label:"ColdFusion"});
var buttonListener:Object = new Object();
buttonListener.click = function(evt_obj:Object) {
if (my_list.selectedIndex != undefined) {
my_list.replaceItemAt(my_list.selectedIndex, {data:"flex",
label:"Flex"});
}
}
replace_button.addEventListener("click", buttonListener);
796
List component
that indicates the position at
List.length
label
and
properties.
data
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers