8 Replies Latest reply on May 6, 2011 1:35 PM by Oliver St John

    CreateRootWindow not happening?

    Oliver St John

      Hi folks, hopefully this is a really simple question to answer...

       

      I'm building an HTML/JS based app, and having trouble getting a new window to spawn when clicking a button. Here is my function:

       

      function showMainWindow() {

      var m_options = new air.NativeWindowInitOptions();

       

      var m_rect = new air.Rectangle(100,100,800,600);

       

      var mainPopup = air.HTMLLoader.CreateRootWindow(true, m_options, false, m_rect);

       

      var mainFilePath = air.File.applicationDirectory.resolvePath('main.html');

       

      mainPopup.load(new air.URLRequest('mainFilePath.url'));

      }

       

      Here is the HTML from which I am calling the function:

       

      <div id="login"><a href="javascript:showMainWindow()" onClick="showMainWindow()"><img src="images/loginbutton.png"></a></div>

       

      The main.html file is in the same directory as the initial window file. What am I doing wrong?