Problem with eventlistener on image, where am I going wrong?
What is wrong with the code below, I added the eventlistener at the bottom but it generates an error, cannot find variable, imageview.
What am I doing wrong?
var win = Titanium.UI.currentWindow;
var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/sb1.png');
var imageView = Titanium.UI.createImageView({
image:f,
width:300,
height:200,
top:0
});
win.add(imageView);
imageview.addEventListener('swipe', function(e)
{
Titanium.UI.createAlertDialog({title:'Dialog Box',message:'This message will pop-up'}).show();
});
2 Answers
-
Accepted Answer
in your code, you declare the variable as
imageView
- note the capital V. -
Thanks! My stupid error in other words :-) how embarassing!!!!