Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var win = Ti.UI.createWindow({
- backgroundColor : 'white'
- });
- var self = Ti.UI.createView({
- title : 'Main Window',
- backgroundColor : '#28292c',
- barColor : '#28292c',
- exitOnClose : true,
- height : 'auto',
- navBarHidden : true,
- width : 'auto',
- _moving : false,
- _startx : 0,
- _endx : 0,
- _toggle : false,
- });
- var header = Ti.UI.createView({
- backgroundColor : '#28292c',
- top : 0,
- left : 0,
- height : 50,
- width : 320,
- moving : false, // Custom property for movement
- axis : 0 // Custom property for X axis
- });
- self.add(header);
- // Top left button
- var menuButton = Ti.UI.createButton({
- top : 10,
- left : 10,
- width : 40,
- height : 50,
- font : {
- fontSize : 11
- },
- title : L('Menu'),
- //toggle:false // Custom property for menu toggle
- });
- header.add(menuButton);
- //EVENT Top left button
- menuButton.addEventListener('click', function(e) {
- clickMenu();
- });
- var menuWin = require("menu");
- var menu = new menuWin();
- win.add(menu);
- function clickMenu() {
- Titanium.API.info('Button Clicked');
- if (win == 1) {
- self.animate({
- left : 0, // Movie to Original Position
- duration : 200,
- curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT,
- });
- win = 0;
- }
- // If the menu isn't opened
- else {
- self.animate({
- left : 150, // Move Left
- duration : 200,
- curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT,
- });
- win = 1;
- slide = 1;
- }
- }
- win.add(self);
- win.open();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement