Hi Guys ,
i'm not understand why can't set other labels' background color.
I was able to set the background color which the label was clicked by me. Below is my code , anyone could correct my wrong ?
var sizelbl = []; var item_clicked; for (var i = 0; i < jsonParse['item'].length; i++) { var item_id = jsonParse['item'][i]['id']; var item_name = jsonParse['item'][i]['name']; sizelbl[i] = Ti.UI.createLabel({ item_id : item_id, textAlign : 'center', borderRadius : 5, top : '15%', bottom : '15%', left : '2%', width : '16.5%', height : '65%', color : '#fff', backgroundColor : '#000', text : item_name, }); $.Scroll.add(sizelbl[i]); sizelbl[i].addEventListener('singletap', function(e) { item_clicked = e.source.text; if (item_clicked) { sizelbl[i].setBackgroundColor('#eee'); }else if (!item_clicked) { sizelbl.setBackgroundColor('#000'); } }); }