Iterator.hasNext()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

iterator.hasNext()

Returns

A Boolean value that indicates whether there are (true) or are not (false) more instances in the iterator.

Description

Method; indicates whether there are more instances in the iterator. You typically use this method in a while statement when looping through an iterator.

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);
    }
}