Hi Andreas
Yes, you right. I've added all the images in carousel and want to implement on click event on carousel to get the selected image name or src. Actually, When user select or click on any image, i want to get the image name, source of that image but i am not sure how can i get the selected image name.
1) I know each image has one event but when you have multiple images, then press event gives you very last image reference.
for(i=1; i<3;i++){
var img= new sap.ui.commons.Image("IMG"+i, {
src : "images/carousel/img"+i+".jpg",
alt : "sample image",
width : "200px",
height : "150px"
});
oCarousel.addContent(img);
img.attachPress( function(oControlEvent){
alert("hello"+img.getSrc());
});
it always give the last image src - doesn't matter on which image you click.
2) I just checked the API of carousel for
attachBrowserEvent(sEventType?, fnHandler?, oListener?) - it takes three methods
oCarousel.attachBrowserEvent("click", function()...}), "what will be third parameter");
Thanks for your Andreas...