Titanium Community Questions & Answer Archive

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

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();
});
— asked May 21st 2010 by Stephen Page
  • eventlistener
  • image
  • missing
  • variable
0 Comments

2 Answers

  • Accepted Answer

    in your code, you declare the variable as imageView - note the capital V.

    — answered May 21st 2010 by Kevin Whinnery
    permalink
    0 Comments
  • Thanks! My stupid error in other words :-) how embarassing!!!!

    — answered May 21st 2010 by Stephen Page
    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.