I want to make a logout facebook button wchich return me from menu page to the index page here my code: Titanium.UI.setBackgroundColor('#CC0066');
var win = Titanium.UI.currentWindow; var main = Titanium.UI.createWindow({ background : "#fff", title : "Image View", url:"app.js" });
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
var fb = require('facebook'); fb.appid = "281158112043247"; win.add(fb.createLoginButton({ top : 140, style : fb.BUTTON_STYLE_WIDE, url:'Controller/login.js' }));
fb.addEventListener('logout', function(e) { if(e.success) { if(fb.logout){
Ti.App.fireEvent('grantEntranc', e);
win.close();
}
} });
and Ti.App.addEventListener('grantEntranc', function(event) { main.tabBarHidden = true; main.title = 'Welcome ' ; main.url = 'Controller/app.js'; main.name = event.Userlogin; main.email = event.Useremail; mainTab.window = main;
tabGroup.addTab(loginTab);
tabGroup.addTab(accountTab);
});