Here's a quick example. Every ten seconds the application checks to see if the button has been pressed. If it hasn't it times the application out. It takes at least ten seconds of non clicking for a timeout to occur and may take up to 20 seconds to trigger the timeout. This is a simple scheme - for more exact timing the timer period could be reduced and the boolean replaced by a timestamp. The timer would then check against the timestamp and would be more accurate - if (timenow - timeOfLastClick) > timeoutPeriod ) { timeout the session } .
Paul <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" applicationComplete="init()"> <mx:Script> <![CDATA[ private var timer:Timer; private var clicked:Boolean; [Bindable] private var checkedCount:uint; private function init():void{ timer = new Timer(10000); clicked = false; checkedCount =0; timer.addEventListener(TimerEvent.TIMER, checkTimeout); timer.start(); } private function checkTimeout(event:Event):void { if (clicked){ clicked = false; checkedCount++; } else { currentState = "timeout"; timer.removeEventListener(TimerEvent.TIMER,checkTimeout); timer = null; } } ]]> </mx:Script><mx:states> <mx:State name="timeout"> <mx:AddChild> <mx:Label text="TIMED OUT" /> </mx:AddChild> <mx:RemoveChild target="{button}" /> <mx:RemoveChild target="{lab1}" /> <mx:RemoveChild target="{lab2}" /> </mx:State> </mx:states> <mx:Label id="lab1" text="Press click every ten seconds or so, or risk timeout" /> <mx:Button id="button" label="CLICK ME SOON" click="clicked=true" /> <mx:Text id="lab2" text="{checkedCount}" /> </mx:Application>