var image = [];
for (var i = 0; i < test.length; i++) {
image[i]= Titanium.UI.createImageView({
top: row,
image: avatar
});
win.add(image[i]);
}
image[i].addEventListener('click', function (e) {
alert('image number'+i);
});
im trying to attach an event to an array, but its saying object unidentfied! :)) whats wrong!!
addEventListenercall outside of your for loop? As written, you are accessing an undefined element of yourimagearray.