User Guide
782 List component
Example
The following code displays the label of the item at index position 2. To try this code, drag a
List component to the Stage and give it the instance name my_list. Add the following code to
Frame 1 in the timeline:
var my_list:mx.controls.List;
my_list.addItem({data:'flash', label:'Flash'});
my_list.addItem({data:'dreamweaver', label:'Dreanweaver'});
my_list.addItem({data:'coldfusion', label:'ColdFusion'});
trace(my_list.getItemAt(2).label);
List.hPosition
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
listInstance.hPosition
Description
Property; scrolls the list horizontally to the number of pixels specified. You can’t set
hPosition unless the value of hScrollPolicy is "on" and the list has a maxHPosition that
is greater than 0.
Example
The following code displays the current value of hPosition whenever the list instance is
scrolled horizontally. To try this code, drag a List component to the Stage and give it the
instance name my_list. Add the following code to Frame 1 in the timeline:
var my_list:mx.controls.List;
my_list.setSize(150, 100);
my_list.hScrollPolicy = "on";
my_list.maxHPosition = 50;
my_list.addItem({data:'flash', label:'Flash'});
my_list.addItem({data:'dreamweaver', label:'Dreanweaver'});
my_list.addItem({data:'coldfusion', label:'ColdFusion'});