Thanx, I'll give that a try! P.
>> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:flashcoders- >> [EMAIL PROTECTED] On Behalf Of Chester McLaughlin >> Sent: Thursday, November 09, 2006 5:39 PM >> To: Flashcoders mailing list >> Subject: Re: [Flashcoders] Best way to detect an idle user? >> >> Here's a working class I whipped up. It uses onMouseMove to monitor >> their activity. >> >> // BEGIN CLASS >> // ActivityMonitor >> // Created by Chester McLaughlin on 2006-11-09. >> >> import mx.utils.Delegate; >> import mx.events.EventDispatcher; >> >> class ActivityMonitor { >> >> var nLatestActivity:Number; >> var nMaxIdleTime:Number; >> >> var nIntervalID:Number; >> >> var onMaxIdleTimeExceeded:Function; >> >> private var broadcastMessage:Function; >> public var addListener:Function; >> >> function ActivityMonitor(nMaxIdleTime:Number) >> { >> AsBroadcaster.initialize(this); >> Mouse.addListener(this); >> >> this.onMouseMove(); >> this.nMaxIdleTime = nMaxIdleTime; >> >> this.nIntervalID = setInterval(Delegate.create >> (this,checkForActivity),5000); >> } >> >> function checkForActivity(){ >> var nNow = getTimer(); >> var nDiff = (nNow - this.nLatestActivity)/1000; >> >> if (nDiff >= this.nMaxIdleTime){ >> this.broadcastMessage("maxIdleTimeExceeded",nDiff); >> this.onMaxIdleTimeExceeded(nDiff); >> } >> } >> >> function onMouseMove() >> { >> this.nLatestActivity = getTimer(); >> } >> >> }; >> >> // END CLASS >> >> // BEGIN USAGE >> /* >> import ActivityMonitor; >> >> // This creates an instance of Activity Monitor that requires the user >> // to move their mouse at least once every 5 seconds >> var myActivityMonitor:ActivityMonitor = new ActivityMonitor(5); >> >> // Method #1 >> myActivityMonitor.onMaxIdleTimeExceeded = function(nDiff:Number){ >> //var nDiff:Number = arguments[0]; >> trace("Method 1: You've been idle for "+nDiff+" seconds. Get >> Moving!!!"); >> } >> >> // Method #2 >> myActivityMonitor.addListener(this); >> function maxIdleTimeExceeded(nDiff:Number){ >> trace("Method 2: You've been idle for "+nDiff+" seconds. Get >> Moving!!!"); >> } >> */ >> >> // END USAGE >> >> >> On Nov 9, 2006, at 1:45 PM, Pete Miller wrote: >> >> > >> > My application starts with a user login/authentication. I want to >> > implement an idle user process that logs the user out after X >> > amount of >> > time of no activity. >> > >> > The most obvious way I can think to do this is to start an interval >> > timer, and keep reseting it any time a widget is used. That means >> > adding a reset-function call to every component event handler, plus >> > adding event handlers for many components that otherwise don't have >> > relevant events. >> > >> > Does anyone have a more clever way of handling this? >> > _______________________________________________ >> > [email protected] >> > To change your subscription options or search the archive: >> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > >> > Brought to you by Fig Leaf Software >> > Premier Authorized Adobe Consulting and Training >> > http://www.figleaf.com >> > http://training.figleaf.com >> >> >> This email and any files transmitted with it are confidential and >> intended solely for the use of the individual or entity to whom they are >> addressed. If you are not the named addressee you should not >> disseminate, distribute or copy this e-mail Please notify the sender >> immediately by e-mail if you have received this e-mail by mistake and >> delete this e-mail from your system. Any other use, retention, >> dissemination, forwarding, printing or copying of this e-mail is strictly >> prohibited. Finally, the recipient should check this e-mail and any >> attachments for the presence of viruses. Lambesis accepts no liability >> for any damage caused by any virus transmitted by this email. >> >> _______________________________________________ >> [email protected] >> To change your subscription options or search the archive: >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> Brought to you by Fig Leaf Software >> Premier Authorized Adobe Consulting and Training >> http://www.figleaf.com >> http://training.figleaf.com _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

