ActionScript 2.0 Components Language Reference |
|
|
|
| Iterator interface > Iterator.hasNext() | |||
Flash Player 7.
Flash MX Professional 2004.
iterator.hasNext()
A Boolean value that indicates whether there are (true) or are not (false) more instances in the iterator.
Method; indicates whether there are more instances in the iterator. You typically use this method in a while statement when looping through an iterator.
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);
}
}
|
|
|
|