File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes iOS and the fly likes Add Action listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Add Action listener " Watch "Add Action listener " New topic
Author

Add Action listener

asif Bashir
Greenhorn

Joined: May 14, 2013
Posts: 1
I am creating an App for iPhone using JavaScript. I have an array of images, let say img[] ,and a place all these images on screen i want to add action listener to each image. Each image has to perform different functionality. I am using this method

for(var i=0;i<img.length)
{
img[i].addactionlistner('click',function(e){
//Print the index of image clicked
});


}
This method add action listener to images.Please tell me that this method is right or not. If yes then how can i identify that which image is clicked(it should tell me the index).
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

You are creating a native iOS app using JavaScript?

Any way, is the method you are using is correct or not? Try it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Add Action listener
 
Similar Threads
Java drawimage on jlabel
Adding image to JPanel to display on JLable
multiple action listeners .setActionCommand Vs. addActionListener(new comboListListener())
need help with action listeners and events
Very basic problem