I'm stuck with having a button open a new window that shows a full url (http://mysamplesite.com).
var b1 = Titanium.UI.createButton({ image:'images/site.png', width:160, height:95, top:10 }); b1.addEventListener('click', function() { var win = Ti.UI.createWebView({ url:'http://mysamplesite.com', title:'My Site', height:'auto',width:'auto' }); Titanium.UI.currentTab.open(win,{animated:true}); }); win.add(b1);Any ideas?
2 Answers
There is some time since the windows don't open a web url anymore. Try like this:
var b1 = Titanium.UI.createButton({ image:'images/site.png', width:160, height:95, top:10 }); b1.addEventListener('click', function() { var win2 = Ti.UI.createWebView({ title:'My Site', height:'auto',width:'auto' }); var webview = Titanium.UI.createWebView({ url:'http://mysamplesite.com', }); win2.add(web_view); Titanium.UI.currentTab.open(win2,{animated:true}); }); win.add(b1);
Just figured it out. It should be createWindow first, then createWebView
b1.addEventListener('click', function() { var win2 = Ti.UI.createWindow({ title:'My Site', height:'auto',width:'auto' }); var webview = Titanium.UI.createWebView({ url:'http://mysamplesite.com', }); win2.add(web_view); Titanium.UI.currentTab.open(win2,{animated:true}); });
Your Answer
Think you can help? Login to answer this question!