Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // this sets the background color of the master UIView (when there are no windows/tab groups on it)
  2. Titanium.UI.setBackgroundColor('#000');
  3.  
  4. // create tab group
  5. var tabGroup = Titanium.UI.createTabGroup();
  6. tabGroup.orientationModes = [Titanium.UI.PORTRAIT];
  7.  
  8. //
  9. // create base UI tab and root window
  10. //
  11.  
  12. var win2 = Titanium.UI.createWindow({ title:'Tab 2', backgroundColor:'#fff' });
  13. var button2 = Ti.UI.createButton({ title:'Watch YouTube Video', height:40 });
  14. button2.addEventListener('click', function() {
  15. var win3 = Titanium.UI.createWindow({ title:'YouTube', backgroundColor:'#CCC' });
  16. var url = 'http://www.youtube.com/watch?v=6b4ZZQkcNEo';
  17. var html = '<html>' +
  18. '<head><style type"text/css"> * { margin:0; padding:0; }</style></head>' +
  19. '<body>' +
  20. '<center>' +
  21. '<object width="320" height="240">' +
  22. '<param name="movie" value="' + url + '&autoplay=1&rel=0&hl=en_US&fs=1&"></param>' +
  23. '<param name="allowFullScreen" value="true"></param>' +
  24. '<param name="allowscriptaccess" value="always"></param>' +
  25. '<embed src="' + url + '&autoplay=1&rel=0&hl=en_US&fs=1&" type="application/x-shockwave-flash"' +
  26. 'allowscriptaccess="always" allowfullscreen="true" width="320" height="240"></embed></object>' +
  27. '</center>' +
  28. '</body>' +
  29. '</html>';
  30. var webview = Ti.UI.createWebView({ top: 0, left: 0, fullscreen:true, html: html, height:240, width:320 });
  31. win3.add(webview);
  32.  
  33. // win3.addEventListener('focus', function() { // webview.html = html; // webview.height = 240; // webview.width = 320; // });
  34. tabGroup.activeTab.open(win3);
  35. });
  36. win2.add(button2);
  37.  
  38. //
  39. // create tabs
  40. //
  41. var tab2 = Titanium.UI.createTab({ icon:'KS_nav_ui.png', title:'Tab 2', window:win2 });
  42.  
  43. //
  44. // add tabs
  45. //
  46. tabGroup.addTab(tab2);
  47.  
  48. // open tab group
  49. tabGroup.open();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement