title: Appcelerator Titanium: How to use the onLoad event of an Window?
body: <pre><code>mainWin.pageLoad=false;
  mainWin.addEventListener('load', function(e) {
    if(mainWin.pageLoad) {
      mainWin.open();    
       } else {
        mainWin.close();    
        var LoginWindow = Titanium.UI.createWindow({ 
          title : 'Login',  
          url:'Login.js'   
        });
     LoginWindow.open();
    }
  });
  </code></pre>
  
  <p>This is my app.js file. If the pageLoad variable holds the boolean value true, then i need to navigate to mainWin <code>{Which is the current Window}</code> else i need to go to Login Page.</p>