This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this would be app.js (for example) | |
var UI = require('myfile'); // no .js extension | |
var win = UI.Window({backgroundColor:'#999'}); | |
var view = UI.View({top:20,left:20,right:20,bottom:20,backgroundColor:'#ccc'}); | |
win.add(view); | |
win.open(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({backgroundColor:'#ccc'}); | |
var isRunning = false; | |
var btn = Ti.UI.createButton({ | |
title:'start', | |
bottom:10, | |
height:50, | |
left:10, | |
right:10 | |
}); | |
var slider = Ti.UI.createSlider({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Titanium.Media.openPhotoGallery({ | |
success:function(event){ | |
var myImage = event.media; | |
var xhr = Titanium.Network.createHTTPClient(); | |
xhr.open('POST','http:// ------ /uploads.php'); | |
xhr.onerror = function(e){alert(e.error);}; | |
xhr.setTimeout(200000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.createWindow({ | |
title:'table', | |
}); | |
var table = Ti.UI.createTableView({}); | |
win.add(table); | |
var oldRow = {}; | |
function swipe(a,b,c){ | |
// a = view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple and tiny chess for Appcelerator | |
// Javascript chess engine (c)2011 Oscar Toledo G. | |
// Modified by @pecdev with the help of @pec1985 (follow us on twitter) | |
// For information on the code, please visit: http://nanochess.110mb.com/chess4.html | |
var B,i,y,u,b,I=[],G=120,x=10,z=15,M=1e4,l=[5,3,4,6,2,4,3,5,1,1,1,1,1,1,1,1,9,9,9,9 | |
,9,9,9,9,13,11,12,14,10,12,11,13,0,99,0,306,297,495,846,-1,0,1,2,2,1,0,-1,-1,1,-10, | |
10,-11,-9,9,11,10,20,-9,-11,-10,-20,-21,-19,-12,-8,8,12,19,21];function X(w,c,h,e,S | |
,s){var t,o,L,E,d,O=e,N=-M*M,K=78-h<<x,p,g,n,m,A,q,r,C,J,a=y?-x:x;y^=8;G++;d=w||s&& | |
s>=h&&X(0,0,0,21,0,0)>M;do{if(o=I[p=O]){q=o&z^y;if(q<7){A=q--&2?8:4;C=o-9&z?[53,47, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tested only in safari. Use at your own risk. | |
Element.prototype.fireEvent = function(a,b) { | |
b = b || {}; | |
b.type = a; | |
b.source = this; | |
var evt = document.createEvent("Events"); | |
evt.initEvent(a, true, true); | |
for(var i in b){ | |
if(b){ evt[i] = b[i]; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor:'#ccc' | |
}); | |
var mainView = Ti.UI.createScrollView({ | |
top:0, | |
bottom:0, | |
right:0, | |
left:0, | |
contentWidth:320, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor:'white' | |
}); | |
function myRow(e){ | |
e = e || {}; | |
e.height = e.height || 44; | |
e.left = 0; | |
e.right = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ar win = Ti.UI.createWindow({backgroundColor:'#676767'}); | |
//FYI - this image is big, it will take a few seconds to appear | |
var file = 'http://bassemk.files.wordpress.com/2009/12/landscape-fall-creek-falls-and-snake-river-idaho.jpg'; | |
var start=function(file){ | |
var newHeight; | |
var newWidth; | |
var fileWidth=file.blob.width; | |
var fileHeight=file.blob.height; |