Selecting first item from listcomponent

Hello,

I’ve written the following code to load images in a datagridcomponent by using a listcomponent. What code do i use to automatically select the first item.


import fl.data.DataProvider;
import fl.managers.StyleManager;

var currentCategory:int;
var currentItem:int;

var catalogFormat:TextFormat = new TextFormat();

catalogFormat.font = "Verdana, Arial, Helvetica";
catalogFormat.size = 12;
catalogFormat.color = 0x666666;
catalogFormat.bold = true

StyleManager.setStyle("textFormat", catalogFormat);

var productsURL:URLRequest = new URLRequest("products.xml");
var xmlLoader:URLLoader = new URLLoader(productsURL);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

var productsXML:XML = new XML();
productsXML.ignoreWhitespace = true;

function xmlLoaded(evt:Event):void{
    productsXML = XML(xmlLoader.data);
    trace(productsXML);
    var aCategory:Array = new Array();
    for(var category:String in productsXML.category){
        var categoryName:String = productsXML.category[category][email protected];
        aCategory.push(categoryName);
    }
    var dpCategory:DataProvider = new DataProvider(aCategory);
    liCategory.dataProvider = dpCategory;
}

function selectCategory(evt:Event):void{
    currentCategory = evt.target.selectedIndex;
    var aImages:Array = new Array();
    for (var item:String in productsXML.category[currentCategory].item){
        var itemLabel:String = productsXML.category[currentCategory].item[item].name;
        var itemImage:String = "thumbs/" + productsXML.category[currentCategory].item[item].image+"_sm.jpg";
        aImages.push({label:itemLabel, source:itemImage});
    }
    tlImages.columnWidth = 120;
    tlImages.rowHeight = 120;
    var dpImages:DataProvider = new DataProvider(aImages);
    tlImages.dataProvider = dpImages;
    tlImages.columnCount = 4;
    tlImages.rowCount = 2;
}
liCategory.addEventListener(Event.CHANGE, selectCategory);

function selectProduct(evt:Event):void{
    currentItem = evt.target.selectedIndex;
    var itemLabel:String = productsXML.category[currentCategory].item[currentItem].name;
    var itemDesc:String = productsXML.category[currentCategory].item[currentItem].desc;
    var itemPrice:String = productsXML.category[currentCategory].item[currentItem].price;
    var itemArtNr:String = productsXML.category[currentCategory].item[currentItem].artNr;
    taPrice.text = "€  "+itemPrice;
    taDesc.text = itemLabel +"
" + itemDesc;
}
tlImages.addEventListener(Event.CHANGE, selectProduct);

thanks for a solution