Iterator interface (Flash Professional only)
ActionScript Class Name
The Iterator interface lets you step through the objects that a collection contains.
Method summary for the Iterator interface
The following table lists the methods of the Iterator interface.
Method
Iterator.hasNext()
Iterator.next()
Iterator.hasNext()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
iterator.hasNext()
Returns
A Boolean value that indicates whether there are (
iterator.
Description
Method; indicates whether there are more instances in the iterator. You typically use this method
in a
statement when looping through an iterator.
while
Example
The following example uses the
items in a collection:
on (click) {
var myColl:mx.utils.Collection;
myColl = _parent.thisShelf.MyCompactDisks;
var itr:mx.utils.Iterator = myColl.getIterator();
while (itr.hasNext()) {
var cd:CompactDisk = CompactDisk(itr.next());
var title:String = cd.Title;
var artist:String = cd.Artist;
trace("Title: "+title+" Artist: "+artist);
}
}
mx.utils.Iterator
Description
Indicates whether the iterator has more items.
Returns the next item in the iteration.
true
method to control looping through the iterator of
hasNext()
Components Dictionary
) or are not (
) more instances in the
false
Iterator interface (Flash Professional only)
CHAPTER 6
441
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?