3 Replies Latest reply on Feb 26, 2008 2:17 PM by jylaxx

    how to know if user inactive

      I'm writing a Flex chat application. I need to know if a user has become inactive - that is, their screen saver has turned on or their computer has gone to sleep. Is there any way to do this?
        • 1. how to know if user inactive
          Starlover_jacob Level 1
          i don't know a simple solution.. like get a trigger from the screensaver or so..

          what you could do is monitor every action in your program. if action is taken it sets a timer at zero.
          if no action is taken the timer just runs.. for lets say 15 minutes..
          if it reaches 15 minutes you than let a trigger go off and do whatever you want..

          what would you like to do? because i don't think you can do something when the computer has gone into sleep mode.
          • 2. Re: how to know if user inactive
            happybrowndog Level 1
            Thanks for your reply.

            I'd like to do something like the way Google Talk does. When the user has not been active on his computer, other users on the chat system are notified of this discreetly with a greyed out symbol denoting that the user has become inactive.

            Your idea sounds good, but I was more wondering if there was some event that I could trap for that detects when the computer has gone idle. By idle I mean the screen saver has turned on, or the computer has gone into sleep mode, or the computer session is locked, etc. Any one of these would be a good start.

            Any ideas?
            • 3. Re: how to know if user inactive
              jylaxx Level 1
              You don't have access to the OS API from Flash Player. So the only thing you can do is detecting inactive period of your Flex application. I don't know if it is enough.
              You have to add listener on keyboard and mouse event and do as jacob said. Each event reset timer and when the timer reach the delay you defined you update the user status.