hey all,
how to navigate/call other .js file after click event on button. once it ciick it will goes to other window. osplease help me to solve this problem
thanks,
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Please find below a quick sample, focused around iOS. There are a bunch more available in the Kitchen Sink example App available here:
https://github.com/appcelerator/titanium_mobile/tree/master/demos/KitchenSink
Steps:
1) Create Titanium Mobile Project
2) In the app.js file add the below
var winPage1 = Ti.UI.createWindow({ url:'page1.js', title:'Page 1' }); winPage1.open();3) Add a file in the same directory as app.js called page1.js, then paste this in
var win = Ti.UI.currentWindow; (function(){ var b1 = Ti.UI.createButton({ title : 'Press Me', left : 10, top : 100, right : 10, height : 40 }); b1.addEventListener('click', function(e) { var wPage = Ti.UI.createWindow({ title:'Test Page2', backgroundColor:'yellow', url:'page2.js' }); wPage.open({modal:false}); }); win.add(b1); })();4) Add a file in the same directory as app.js called page2.js, then paste this in
var win = Ti.UI.currentWindow; (function(){ var b1 = Ti.UI.createButton({ title : 'Press Me', left : 10, top : 100, right : 10, height : 40 }); b1.addEventListener('click', function(e) { win.close(); }); win.add(b1); })();5) Run in Titanium Developer or Studio
This should give you a running same showing how to open and close windows. Kitchen Sink (link above) has a ton more samples showing different ways to do this.