List.rowCount

Availability

Flash Player 6.0.79.

Edition

Flash MX 2004.

Usage

listInstance.rowCount

Description

Property; the number of rows that are at least partially visible in the list. This is useful if you've scaled a list by pixel and need to count its rows. Conversely, setting the number of rows guarantees an exact number of rows will be displayed, without a partial row at the bottom.

The code myList.rowCount = num is equivalent to the code myList.setSize(myList.width, h) (where h is the height required to display num items).

The default value is based on the height of the list as set while authoring, or set by the list.setSize() method (see UIObject.setSize()).

Example

The following example discovers the number of visible items in a list:

var rowCount = myList.rowCount;

The following example makes the list display four items:

myList.rowCount = 4; 

This example removes a partial row at the bottom of a list, if there is one:

myList.rowCount = myList.rowCount; 

This example sets a list to the smallest number of rows it can fully display:

myList.rowCount = 1;
trace("myList has "+myList.rowCount+" rows");