Skip to content

Instantly share code, notes, and snippets.

@benbahrenburg
Created January 30, 2012 16:05
Show Gist options
  • Save benbahrenburg/1705155 to your computer and use it in GitHub Desktop.
Save benbahrenburg/1705155 to your computer and use it in GitHub Desktop.
backgroundGradient Error
//Setup our app namespace
var my={};
//Bring in our helpers
my.helpers=require('helpers');
//Bring in our custom UI elements
my.uiHelpers=require('ui_helper');
//Bring in our fake modules
my.mod=require('some_mod');
//Let's get a window
my.win=my.mod.fetchWindow();
//Open the window
my.win.open();
exports.makeWindow=function(a){
a = a || {};
var win = Ti.UI.createWindow(a);
win.orientationModes = [
Ti.UI.PORTRAIT,
Ti.UI.UPSIDE_PORTRAIT
];
return win;
};
exports.fetchWindow=function(){
//We make a window
var win = my.helpers.makeWindow();
//We use a UI helper to get a Yellow view
//In the read world this would be a custom control
win.add(my.uiHelpers.uglyVw())
//return the window
return win;
};
exports.uglyVw=function(){
var uglyView = Ti.UI.createView({
top:10,
height:150,
backgroundGradient:{
type:'radial',
colors:[{color:'yellow',position:0},{color:'white',position:1}]
}
});
//Show the error, not ment to be a good example of coding
uglyView.addEventListener('click', function(e) {
Ti.API.info('This would call an inner function or osmething');
});
return uglyView;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment