On the click of my button, I want to navigate to another screen. How would I achieve this in Titanium?
var TrialButton = Titanium.UI.createButton({
color:'black',
backgroundColor:'#FFFFFF',
title:'Trial Mode',
top:55,
width:300,
height:50,
borderRadius:5,
font:{fontSize:18, fontFamily :'Helvetica', fontWeight:'bold'}
});
TrialButton.addEventListener('click', function() {
var newWindow = Titanium.UI.createWindow({
background : "#fff",
title : "Trial Demo",
url:"nextScreen.js"
});
newWindow.open();
});
Because its written wrong. Theres an error in code at the last line. The ")" has to follow after "}". Not opposite ast written here. So the closing tag is right like this: "});". Use following code instead:
If you're using Alloy, You can also navigate to another screen using the Alloy.createController method.
function sample(e) {
}
If you wish, you can also pass data to the next screen by passing it in as an argument eg,
var nextScreen = Alloy.createController('nameOfNextScreen', {sushi: "california roll" }).getView();
and retrieving the argument in the next screen with the following
var args = $.args;
var value = args.sushi;
should checkout examples here https://github.com/appcelerator/KitchenSink
here are some posts from my blog http://blog.clearlyinnovative.com/tagged/Appcelerator