![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Flash Player 6.0.79.
Flash MX 2004.
listInstance
.addItem(label
[,data
])listInstance
.addItem(itemObject
)
label
A string that indicates the label for the new item.
data
The data for the item. This parameter is optional and can be any data type.
itemObject
An item object that usually has label
and data
properties.
The index at which the item was added.
Method; adds a new item to the end of the list.
In the first usage example, an item object is always created with the specified label
property, and, if specified, the data
property.
The second usage example adds the specified item object.
Calling this method modifies the data provider of the List component. If the data provider is shared with other components, those components will update as well.
Both of the following lines of code add an item to the myList
instance. To try this code, drag a List to the Stage and give it the instance name myList. Add the following code to Frame 1 in the Timeline:
myList.addItem("this is an Item"); myList.addItem({label:"Gordon",age:"very old",data:123});
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |