Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 1.24 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Titanium.UI.setBackgroundColor('#ccc');
  2.  
  3. var win1 = Titanium.UI.createWindow({  
  4.     title:'Tab 1',
  5.     backgroundColor:'#fff',
  6.     fullscreen: true
  7. });
  8.  
  9. var circle = Titanium.UI.createView({
  10.         height:32,
  11.         width:32,
  12.         borderRadius:4,
  13.         backgroundColor:'#369'
  14. });
  15.  
  16. /*
  17. circle.addEventListener('touchstart', function(e)
  18. {
  19.         Ti.API.debug('touchstart, the center is ' + e.x + ', ' + e.y );
  20.         circle.backgroundColor = '#39F';
  21.         circle.height = 64;
  22.         circle.width = 64;
  23.         circle.borderRadius = 8;
  24.         circle.borderColor = '#c30';
  25. });
  26. */
  27.  
  28. circle.addEventListener('touchmove', function(e)
  29. {
  30.         Ti.API.debug('Before anim, the center is ' + e.x + ', ' + e.y +' - type is: '+e.type);
  31.         var newX = e.x + circle.animatedCenter.x - circle.width/2;
  32.         var newY = e.y + circle.animatedCenter.y - circle.height/2;
  33.         circle.animate({center:{x:newX,y:newY}, duration:0});
  34. });
  35.  
  36. /*
  37.  
  38. circle.addEventListener('touchend', function(e)
  39. {
  40.         circle.x = e.x;
  41.         circle.y = e.y;
  42.         Ti.API.debug('newx is '+e.x);
  43.         Ti.API.debug('newy is '+e.y);
  44.         circle.backgroundColor = '#369';
  45.         circle.height = 32;
  46.         circle.width = 32;
  47.         circle.borderRadius = 4;
  48.         circle.borderColor = 'transparent';    
  49. });
  50. */
  51.  
  52. win1.add(circle);
  53.  
  54. // App should start with win1 open
  55. win1.open();