Wow, that is a great thing to know.  I was going to point Rick to my
example on cflex.net which uses ordinary mouse and KB activity and a
Timer to initiate timeout processing, but a SystemManager idle event
looks much more elegant.  I'll update my example when I get a chance.

 

Thanks,

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jim Cheng
Sent: Friday, March 02, 2007 3:09 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Application Idleness

 

Rick Root wrote:
> Does anyone have any suggestions for monitoring idleness of a Flex
> application?

I'm assuming you're using Flex 2.0--if you're using the Flex Framework 
as a basis for development (as opposed to rolling your own ActionScript 
3.0-only project), this functionality is actually supported out of the 
box by the SystemManager.

The SystemManager will dispatch an idle event every 100ms after there 
has been no keyboard or mouse activity. You can register your own 
listener for this event and determine if too many such events have been 
issued without a gap in between (indicating user interaction).

If you don't mind using the mx_internal namespace (where Adobe hides 
implementation details that are subject to change between versions 
without notice, see the FlexComponents list for more details), you can 
even inspect the internal idleCounter variable which details the number 
of frames elapsed since the last detected keyboard or mouse activity.

Read more about it on the LiveDocs documentation here:

http://livedocs.macromedia.com/flex/2/langref/mx/managers/SystemManager.
html
<http://livedocs.macromedia.com/flex/2/langref/mx/managers/SystemManager
.html> 

If you're brave, the source to SystemManager, as well as most of the 
rest of the Flex Framework, can be found in your Flex 2 SDK frameworks 
directory. There's a ton of neat stuff just waiting to be discovered in 
there.

Jim Cheng
effectiveUI

 

Reply via email to