Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Multiple Image Views w/ EventListeners

I have a scroll view with multiple imageViews inside.

I'm adding the imageViews in a for loop (with at least 10-20).

How would I properly add an eventListener for a click on each imageView and then pass in a photo id?

— asked July 21st 2010 by John Welch
  • gallery
  • imageview
  • photos
  • scrollview
0 Comments

1 Answer

  • Within the for loop do this:

    var photoId = ##
    
    image.photoId = photoId;
    
    image.addEventListener('click', function(e)
    {
        photoPage.photoId = e.source.photoId;
        tab.open(photoPage,{animated:true});
    });
    
    — answered July 21st 2010 by John Welch
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.