var n:Number = 0; for each(var i:Object in blockList.dataProvider) { if(i.id == blockId) { blockList.selectedIndex = n; break; } n++; }