List.rowCount

Availability

Flash Player 6 (6.0.79.0).

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 that an exact number of rows is displayed, without a partial row at the bottom.

The code my_list.rowCount = num is equivalent to the code my_list.setSize(my_list.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 during authoring, or as set by the List.setSize() method (see UIObject.setSize()).

Example

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

var rowCount = my_list.rowCount;

The following example makes the list display four items:

my_list.rowCount = 4;

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

my_list.rowCount = my_list.rowCount;

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

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

The following example resizes the list using the setSize() method and then sets a row count of 8 items:

my_list.addItem({data:"flash", label:"Flash"});
my_list.addItem({data:"dreamweaver", label:"Dreamweaver"});
my_list.addItem({data:"coldfusion", label:"ColdFusion"});

my_list.setSize(200, 30);
my_list.rowCount = 8;
trace("my_list has " + my_list.rowCount + " rows.");