5 Replies Latest reply on Oct 30, 2009 12:35 AM by jayuzzz

    How to passing session parameter into installed Air app?

    jayuzzz

      Hi all,

      I am a newbie here and facing a problem. Hope anyone can help.....

       

      I am planning to make a secure quiz application that can be integrated with moodle. I already have a secure window that I want and I am using nativewindow to do that. I want to make the secure quiz application invoke just when quiz in moodle started.

      the problem is how can I pass session parameter from moodle into installed air application? I want to make user doesn't need to login again when using my application but just continue the session.

       

      *** aditional, this is my index.html code.

      *********************************************************begining of my code

      <html>
      <head>
      <script src="AIRAliases.js" type="text/javascript"></script>
      <script src="servicemonitor.swf" type="application/x-shockwave-flash" />

       

      <script type="text/javascript">
      var urlMonitor;
      var invokeEvent;
      function doWindow()
      {
      var options = new air.NativeWindowInitOptions();
      options.transparent = false;
      options.systemChrome = air.NativeWindowSystemChrome.STANDARD;
      options.minimizable = false;
      options.maximizable = false;
      options.resizable=false;
      var windowBounds = new air.Rectangle(0,0,air.Capabilities.screenResolutionX,air.Capabilities.screenResolutionY);
      var urlreq="http://www.example.com";//how can I pass the parameter here ?

      var newHTMLLoader = air.HTMLLoader.createRootWindow(true, options, true, windowBounds);
      newHTMLLoader.load(new air.URLRequest(urlreq));

      newHTMLLoader.stage.nativeWindow.alwaysInFront = true;
      newHTMLLoader.stage.nativeWindow.addEventListener(air.NativeWindowBoundsEvent.MOVE,handle move);
      newHTMLLoader.stage.nativeWindow.addEventListener(air.Event.CLOSE,onCloseCommand);
      urlMonitor = new air.URLMonitor(new air.URLRequest("http://www.example.com"));
      urlMonitor.addEventListener(air.StatusEvent.STATUS, onStatusChange);
      urlMonitor.start();
      air.NativeApplication.nativeApplication.addEventListener(air.InvokeEvent.INVOKE, onInvoke);
      function handlemove()
      {
      newHTMLLoader.stage.nativeWindow.x=0;
      newHTMLLoader.stage.nativeWindow.y=0;
      }


      function onCloseCommand(exitingEvent) {
      var winClosingEvent;
      for (var i = 0; i < air.NativeApplication.nativeApplication.openedWindows.length; i++) {
      var win = air.NativeApplication.nativeApplication.openedWindows[i];
      winClosingEvent = new air.Event(air.Event.CLOSING,false,true);
      win.dispatchEvent(winClosingEvent);
      if (!winClosingEvent.isDefaultPrevented()) {
      win.close();
      } else {
      exitingEvent.preventDefault();
      }
      }
      if (!exitingEvent.isDefaultPrevented()) {
      }
      }

       

      function onStatusChange(event)
      {
      if (urlMonitor.available)
      {
      alert("The current network status is Connected");
      }
      else
      alert("The current network status is Disconnected");
      }
      </script>
      </head>
      <body onload="doWindow()">
      testing
      </body>

       

      </html>

      ************************************************end of my code

      please help me

      thanks