title: Titanium Appcelerator: How do I target $(this) element?
body: <p>I am designing a flashcard app using titanium appcelerator, the final aim is to use a scrollable view to display each card in the 'pack' and then on tapping a single card (i.e. the card in view) this should rotate about it's axis (i.e. flip over) to reveal the reverse.</p>
  
  <p>You can see from the diagram below what I am hoping to achieve.</p>
  
  <p><img src="https://i.stack.imgur.com/LWMVE.png" alt="enter image description here"></p>
  
  <p>Unfortunately when tap one of the panels, instead of it's child view animating, instead the <strong>last child</strong> in the scrollableview animates.</p>
  
  <p>I understand this is something to do with the fact that I am assigning variables in a loop but if someone can look at my code and tell me what I am doing wrong that would be great.</p>
  
  <p>In JQuery it would look something like this</p>
  
  <pre><code>$(FrontView).click(function(){
  
  $(this).parent().flip() //how do I access $(this) and $(this).parent() in Appcelerator?
  
  });
  </code></pre>
  
  <p>Here is my appcelerator code:</p>
  
  <pre><code>while(rows.isValidRow()){
  
           var FrontView = Ti.UI.createView({
  
            backgroundImage: '/global/card_bg.png',
            width: 295,
           height:297
  
      });  
  
           var BackView = Ti.UI.createView({
  
            backgroundImage: '/global/card_bg.png',
            width: 295,
            height:297
  
      });  
  
  
   var ControlView = Titanium.UI.createView({
   backgroundColor:"#333",
   bubbleParent : false,
   width: 295,
   height:297,
   top : 100
  
  }); 
  
  FrontView.addEventListener('singletap', function() {
          Ti.API.info('singletap');
          ControlView.animate({view:BackView,transition:Ti.UI.iPhone.AnimationStyle.FLIP_FROM_RIGHT});
  
      });
  
  BackView.addEventListener('singletap', function() {
          Ti.API.info('singletap');
  ControlView.animate({view:FrontView,transition:Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});
  
      });
  
  
    $.scrollable_view.addView(ControlView);
    ControlView.add(BackView);  
    ControlView.add(FrontView);  
  
   rows.next();
  
  } //endwhile
  </code></pre>
  
  <p><strong>Can anybody help?</strong></p>