
Untitled
By: a guest on
May 11th, 2012 | syntax:
None | size: 1.24 KB | hits: 16 | expires: Never
Titanium.UI.setBackgroundColor('#ccc');
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
fullscreen: true
});
var circle = Titanium.UI.createView({
height:32,
width:32,
borderRadius:4,
backgroundColor:'#369'
});
/*
circle.addEventListener('touchstart', function(e)
{
Ti.API.debug('touchstart, the center is ' + e.x + ', ' + e.y );
circle.backgroundColor = '#39F';
circle.height = 64;
circle.width = 64;
circle.borderRadius = 8;
circle.borderColor = '#c30';
});
*/
circle.addEventListener('touchmove', function(e)
{
Ti.API.debug('Before anim, the center is ' + e.x + ', ' + e.y +' - type is: '+e.type);
var newX = e.x + circle.animatedCenter.x - circle.width/2;
var newY = e.y + circle.animatedCenter.y - circle.height/2;
circle.animate({center:{x:newX,y:newY}, duration:0});
});
/*
circle.addEventListener('touchend', function(e)
{
circle.x = e.x;
circle.y = e.y;
Ti.API.debug('newx is '+e.x);
Ti.API.debug('newy is '+e.y);
circle.backgroundColor = '#369';
circle.height = 32;
circle.width = 32;
circle.borderRadius = 4;
circle.borderColor = 'transparent';
});
*/
win1.add(circle);
// App should start with win1 open
win1.open();