User Guide

766 List component
To create a List component instance using ActionScript:
1. Drag the List component from the Components panel to the library.
This adds the component to the library, but doesnt make it visible in the application.
2. Select the first frame in the main Timeline, open the Actions panel, and enter the
following code:
this.createClassObject(mx.controls.List, "my_list", 1);
my_list.addItem({label:"One", data:dt1});
my_list.addItem({label:"Two", data:dt2});
This script uses the method UIObject.createClassObject() to create the List instance.
3. Select Control > Test Movie.
Customizing the List component
You can transform a List component horizontally and vertically while authoring and at
runtime. While authoring, select the component on the Stage and use the Free Transform tool
or any of the Modify > Transform commands. At runtime, use the
List.setSize() method
(see
UIObject.setSize()).
When a list is resized, the rows of the list shrink horizontally, clipping any text within them.
Vertically, the list adds or removes rows as needed. Scroll bars position themselves
automatically. For more information about scroll bars, see “ScrollPane component”
on page 1093.
Using styles with the List component
You can set style properties to change the appearance of a List component.