RE: [Flashcoders] Timeout from Flash page

2006-05-25 Thread Bernard Visscher
You could go for a serverpage that is polled every minute or so from the
flashclient, with sendandload or xmlsocket.
If the poll doesn't arrive anymore, unlock the file. This way the file could
be locked for one minute when a client has gone, not more...
Don't put the unlocking logic into a client... 

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Namens Randy Tinfow
 Verzonden: donderdag 25 mei 2006 22:07
 Aan: flashcoders@chattyfig.figleaf.com
 Onderwerp: [Flashcoders] Timeout from Flash page
 
 We've got a Flash intranet app that offers write privileges 
 to the first user and locks out subsequent concurrent users.  
 Sometimes a user will walk away without closing the browser 
 or logging out of the app.  This is a problem because the 
 program remains locked indefinitely.
 
 Is there a method in Flash to detect inactivity and forward 
 to a new page after an interval of time?  Tried this with the 
 mouse listener and it disabled all the buttons.
 
 Any suggestions?
 
 Thanks,
 
 Randy Tinfow
 IMAGE PLANT
 ___
 Flashcoders@chattyfig.figleaf.com
 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
 

___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] Timeout from Flash page

2006-05-25 Thread Bernard Visscher
 Sorry, didn't read the question right.
The below still stands imho.

But you could start a global timer and on every mousemove or keypress reset
it.
If the timer reaches it's end, give the user a popup with a 30 sec answer
period.
If the user doen't interact, unlock the file and the user is readonly.


 -Oorspronkelijk bericht-
 Van: Bernard Visscher [mailto:[EMAIL PROTECTED] 
 Verzonden: donderdag 25 mei 2006 22:12
 Aan: 'Flashcoders mailing list'
 Onderwerp: RE: [Flashcoders] Timeout from Flash page
 
 You could go for a serverpage that is polled every minute or 
 so from the flashclient, with sendandload or xmlsocket.
 If the poll doesn't arrive anymore, unlock the file. This way 
 the file could be locked for one minute when a client has 
 gone, not more...
 Don't put the unlocking logic into a client... 
 
  -Oorspronkelijk bericht-
  Van: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Namens 
 Randy Tinfow
  Verzonden: donderdag 25 mei 2006 22:07
  Aan: flashcoders@chattyfig.figleaf.com
  Onderwerp: [Flashcoders] Timeout from Flash page
  
  We've got a Flash intranet app that offers write privileges to the 
  first user and locks out subsequent concurrent users.
  Sometimes a user will walk away without closing the browser 
 or logging 
  out of the app.  This is a problem because the program 
 remains locked 
  indefinitely.
  
  Is there a method in Flash to detect inactivity and forward 
 to a new 
  page after an interval of time?  Tried this with the mouse listener 
  and it disabled all the buttons.
  
  Any suggestions?
  
  Thanks,
  
  Randy Tinfow
  IMAGE PLANT
  ___
  Flashcoders@chattyfig.figleaf.com
  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
  

___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] Timeout from Flash page

2006-05-25 Thread Keith Reinfeld
Randy, 

Someone posted a similar question awhile back. I decided to write this
IdleTimeout class (as an exercise) to see what I could figure out. 

Do some testing before using it with your app. 

I would greatly appreciate any feedback that you or any other interested
party cares to provide. 

-- Watch the wrap --

[code] 
/*
 ***
 *Keith H. Reinfeld*
 * *
 *[EMAIL PROTECTED]  *
 ***
 * Application IdleTimeout.
 *Usage:
 *Define a function in your FLA to execute the desired actions when the idle
timeout ellapses.
 *Include in your function a 'yourObject.killIdleTimeout()' call
 *to clear the interval and turn off the listeners.
 *Instantiate this class:
 *var yourObject:IdleTimeout = new IdleTimeout(hours, minutes, seconds,
yourFunctionNameHere);
 */
import mx.utils.Delegate;
class com.khr.IdleTimeout {
//declare timeout variables
//h = how many hours
private var h:Number;
//m = how many minutes
private var m:Number;
//s = how many seconds
private var s:Number;
//userFunc = Function
private var userFunc:Function;
//set a reasonable minimum for the timeout interval: (integer  0) *
milliseconds
private var iTODurMin:Number;
//time in milliseconds
private var tmpITOIntDur:Number;
//listener objects
private var keysIdleTimeout:Object = new Object();
private var mouseIdleTimeout:Object = new Object();
//make public for testing in trace output
private var iTOIntID:Number;
private var iTOIntDur:Number;
private var intFuncRef:String;
private var clsRef:Object;
//Constructor
public function IdleTimeout(hours:Number, minutes:Number,
seconds:Number, funcRef:Function) {
//init values
h = hours;
m = minutes;
s = seconds;
//validate the user function reference
try {
if (funcRef != undefined) {
userFunc = funcRef;
} else {
throw new Error(The fourth arguement - user
function - is +funcRef+.);
}
} catch (clsError:Error) {
trace(***Error: +clsError+***);
}
tmpITOIntDur = (h*360)+(m*6)+(s*1000);
iTODurMin = (60*1000);
//validate the interval duration variable
try {
if ((!isNaN(tmpITOIntDur))  (tmpITOIntDur0)) {
iTOIntDur = tmpITOIntDur;
} else {
throw new Error(Invalid interval duration:
is NaN or less than zero.);
}
} catch (clsError:Error) {
trace(***Error: +clsError+***);
trace(***The interval duration will be set to the
default minimun: +String(iTODurMin)+***);
iTOIntDur = iTODurMin;
}
intFuncRef = onIdleTimeoutEllapsed;
clsRef = this;
startTimeout();
createListeners();
}
//Timeout function
private function onIdleTimeoutEllapsed() {
trace(onIdleTimeoutEllapsed called);
//reset app procedure goes here
userFunc();
}
private function startTimeout() {
trace(startTimeout called);
clearInterval(iTOIntID);
iTOIntID = setInterval(clsRef, intFuncRef, iTOIntDur);
}
private function createListeners() {
trace(createListeners called);
//Key
keysIdleTimeout.onKeyDown =
Delegate.create(clsRef,startTimeout);
Key.addListener(keysIdleTimeout);
//Mouse
mouseIdleTimeout.onMouseMove =
Delegate.create(clsRef,startTimeout);
mouseIdleTimeout.onMouseDown =
Delegate.create(clsRef,startTimeout);
Mouse.addListener(mouseIdleTimeout);
}
public function killIdleTimeout() {
trace(killIdleTimeout called);
clearInterval(iTOIntID);
delete iTOIntID;
delete clsRef;
delete intFuncRef;
delete iTOIntDur;
Key.removeListener(keysIdleTimeout);
Mouse.removeListener(mouseIdleTimeout);
}
}
[/code]


-Keith 
http://home.mn.rr.com/keithreinfeld 
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Randy Tinfow
Sent: Thursday, May 25, 2006 3:07 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Timeout from Flash