2 Replies Latest reply on Jul 6, 2006 9:40 AM by

    Closing specific session

      I have a Flash training application in which I've included my own close button. When the student clicks this button, I call an ASP page with the student's user id. This ASP page then accesses the database and closes the most recent session associated with the id. The Flash app then goes to another frame telling the student that he can close the window.
      The problem I have is if the student uses the IE 'X' button instead of my close button, I am not able to close the session. What I'd like to do, if it's even possible, is to have a beforeUnload function that goes to the ASP page and closes the session, but I need a way to give it the correct user id from Flash or to at least save it in the html document somewhere.
      Does anyone have any ideas?

      Chris
        • 1. Re: Closing specific session
          samdl1
          the beforeUnload function will not broadcast if the window is closed (well I'm 95% sure it wont!) the only thing you can do is use the javascript equivalent for when the window closes. Its not a brilliant function and is a bit ropey in its application in browsers but it may just do the trick...You can then write the user id in a javascript variable when you first write the page from ASP and use it to pass it back as a URLencoded variable...If this is what you are after Ill give you some more info on it.

          Sam
          • 2. Re: Closing specific session
            I'm not sure if this is what I'm looking for. In fact, I'm not even sure what I'm looking for.
            The crux of the issue is that I need to figure out a way to pass a variable from Flash (_global.sessionId) to an ASP page if the user clicks the IE 'X' (Close) button or presses Alt-F4. Right now, I'm using sendAndLoad to call the ASP page with the appropriate data if the user clicks my Close button.

            Or if there is a way to tell, from Javascript, which frame the Flash app is on, I could use a simple popup when they're not on the last frame telling the student to use the Flash button.