Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. var win = Ti.UI.createWindow({
  2. backgroundColor : 'white'
  3. });
  4.  
  5. var self = Ti.UI.createView({
  6. title : 'Main Window',
  7. backgroundColor : '#28292c',
  8. barColor : '#28292c',
  9. exitOnClose : true,
  10. height : 'auto',
  11. navBarHidden : true,
  12. width : 'auto',
  13. _moving : false,
  14. _startx : 0,
  15. _endx : 0,
  16. _toggle : false,
  17. });
  18.  
  19. var header = Ti.UI.createView({
  20. backgroundColor : '#28292c',
  21. top : 0,
  22. left : 0,
  23. height : 50,
  24. width : 320,
  25. moving : false, // Custom property for movement
  26. axis : 0 // Custom property for X axis
  27. });
  28.  
  29. self.add(header);
  30. // Top left button
  31. var menuButton = Ti.UI.createButton({
  32. top : 10,
  33. left : 10,
  34. width : 40,
  35. height : 50,
  36. font : {
  37. fontSize : 11
  38. },
  39. title : L('Menu'),
  40. //toggle:false // Custom property for menu toggle
  41. });
  42. header.add(menuButton);
  43.  
  44. //EVENT Top left button
  45. menuButton.addEventListener('click', function(e) {
  46.  
  47. clickMenu();
  48. });
  49.  
  50. var menuWin = require("menu");
  51. var menu = new menuWin();
  52. win.add(menu);
  53.  
  54. function clickMenu() {
  55. Titanium.API.info('Button Clicked');
  56. if (win == 1) {
  57. self.animate({
  58. left : 0, // Movie to Original Position
  59. duration : 200,
  60. curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT,
  61. });
  62. win = 0;
  63.  
  64. }
  65. // If the menu isn't opened
  66. else {
  67. self.animate({
  68. left : 150, // Move Left
  69. duration : 200,
  70. curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT,
  71. });
  72.  
  73. win = 1;
  74. slide = 1;
  75. }
  76. }
  77.  
  78. win.add(self);
  79. win.open();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement