Because I can’t change List objects colors I decided to build my own list:
function makeTrackList():void {
var trackCount:int = xmlData.tracks.track.length();
var listItemHeight = 18;
trackList.height = trackCount * listItemHeight;
var listHeight = trackList.height;
var listItemWidth = trackList.width;
var listItemX = 0;
var listItemY = 0;
for (i=0; i<trackCount; i++) {
var listItem:trackListItem = new trackListItem;
listItem.width = listItemWidth;
listItem.height = listItemHeight;
listItem.x = listItemX;
listItem.y = listItemY;
trackList.addChild(listItem);
listItem.trackName.text = xmlData.tracks.track.artist* + " - " + xmlData.tracks.track.title*;
listItemY = listItemY + listItem.height;
}
trackList.addEventListener(MouseEvent.ROLL_OVER,overHand);
trackList.addEventListener(MouseEvent.ROLL_OUT,outClip);
trackList.addEventListener(MouseEvent.CLICK, selectTrack);
}
Building the list goes OK, but how do I know which element has been clicked and how do I handle ROLL_OVER of elements, above ROLL_OVER is for the list itself. Or are there better List objects than the one that comes with Flash CS4.