User Guide
750 Iterator interface (Flash Professional only)
Example
The following example uses the hasNext() method to control looping through the iterator of
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);
}
}
Iterator.next()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
iterator.next()
Returns
An object that is the next item in the iterator.
Description
Method; returns an instance of the next item in the iterator. You must cast this instance to the
correct type.
Example
The following example uses the next() method to access the next item 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);
}
}