User Guide
Using the List component 765
To populate a List instance with a data provider:
1. Drag a List component from the Components panel to the Stage.
2. Select the Free Transform tool and resize the component to fit your application.
3. In the Property inspector, enter the instance name my_list.
4. Select Frame 1 of the Timeline and, in the Actions panel, enter the following:
my_list.dataProvider = myDP;
If you have defined a data provider named myDP, the list fills with data. (For more
information about data providers, see
List.dataProvider.)
5. Select Control > Test Movie to see the list with its items.
To use a List component to control a movie clip instance
1. Drag a List component from the Components panel to the Stage.
2. Select the Free Transform tool and resize the component to fit your application.
3. In the Property inspector, enter the instance name my_list.
4. Create a movie clip on the Stage and give it the instance name my_mc.
5. Open the movie clip in symbol-editing mode and add some animation.
6. Insert a new layer and name it actions.
7. Add the following ActionScript to Frame 1 of the actions layer.
my_list.addItem({label:"play", data:"play"});
my_list.addItem({label:"stop", data:"stop"});
var listHandler:Object = new Object();
listHandler.change = function(evt:Object) {
switch (evt.target.selectedItem.data) {
case "play" :
my_mc.play();
break;
case "stop" :
my_mc.stop();
break;
default :
trace("unhandled event: "+evt.target.selectedItem.data);
break;
}
};
my_list.addEventListener("change", listHandler);
8.
Select Control > Test Movie to use the list to stop and play the my_mc movie clip instance.