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 Images and their events

I am adding 3 50 x 50 png files in imageview. I want to call different click event for them. When I create multiple imageView objects, it does not fire click event for different images, instead it calls the last imgView event. How can resolve this issue?

— asked October 5th 2010 by Adnan Ahmad
  • iphone
2 Comments
  • following code just shows 1st image:

    var imgShare = Titanium.UI.createImageView({height:50,width:50,left:'80px',image:'facebook.png'});
    winFb.add(imgShare);

    var imgShare1 = Titanium.UI.createImageView({left:'-80px',image:'facebook.png',height:50,width:50});
    winFb.add(imgShare1);

    — commented October 5th 2010 by Adnan Ahmad
  • How are you adding the click events?

    — commented October 5th 2010 by Eddie Monge

1 Answer

  • Instead of creating new image objects for every image…. use a single image object and Assuming you want to flip images upon events… try changing the url of the older image object under whatever events you wanna handle(swipe or click…)

    (Guess this should work).

    — answered October 6th 2010 by Satta Ravi
    permalink
    2 Comments
    • no
      actually I have to show all images since I am showing social networking Icon. By taping each Icon it should activate a function

      — commented October 6th 2010 by Adnan Ahmad
    • hi Ahmad

      If you can post your code snippets … the chances of debugging your problem will be higher..

      — commented October 6th 2010 by Satta Ravi
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.