Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this sets the background color of the master UIView (when there are no windows/tab groups on it)
- Titanium.UI.setBackgroundColor('#000');
- // create tab group
- var tabGroup = Titanium.UI.createTabGroup();
- tabGroup.orientationModes = [Titanium.UI.PORTRAIT];
- //
- // create base UI tab and root window
- //
- var win2 = Titanium.UI.createWindow({ title:'Tab 2', backgroundColor:'#fff' });
- var button2 = Ti.UI.createButton({ title:'Watch YouTube Video', height:40 });
- button2.addEventListener('click', function() {
- var win3 = Titanium.UI.createWindow({ title:'YouTube', backgroundColor:'#CCC' });
- var url = 'http://www.youtube.com/watch?v=6b4ZZQkcNEo';
- var html = '<html>' +
- '<head><style type"text/css"> * { margin:0; padding:0; }</style></head>' +
- '<body>' +
- '<center>' +
- '<object width="320" height="240">' +
- '<param name="movie" value="' + url + '&autoplay=1&rel=0&hl=en_US&fs=1&"></param>' +
- '<param name="allowFullScreen" value="true"></param>' +
- '<param name="allowscriptaccess" value="always"></param>' +
- '<embed src="' + url + '&autoplay=1&rel=0&hl=en_US&fs=1&" type="application/x-shockwave-flash"' +
- 'allowscriptaccess="always" allowfullscreen="true" width="320" height="240"></embed></object>' +
- '</center>' +
- '</body>' +
- '</html>';
- var webview = Ti.UI.createWebView({ top: 0, left: 0, fullscreen:true, html: html, height:240, width:320 });
- win3.add(webview);
- // win3.addEventListener('focus', function() { // webview.html = html; // webview.height = 240; // webview.width = 320; // });
- tabGroup.activeTab.open(win3);
- });
- win2.add(button2);
- //
- // create tabs
- //
- var tab2 = Titanium.UI.createTab({ icon:'KS_nav_ui.png', title:'Tab 2', window:win2 });
- //
- // add tabs
- //
- tabGroup.addTab(tab2);
- // open tab group
- tabGroup.open();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement