【问题标题】:How to reset idleCounter for mouse scroll in flex?如何在flex中为鼠标滚动重置idleCounter?
【发布时间】:2011-12-23 13:38:22
【问题描述】:
我正在使用 FlexEvent.IDLE 事件来跟踪用户是否空闲超过 5 分钟。如果是这样,用户将被注销。我还在我的应用程序中调用了一个弹出窗口,它有一个可滚动的数据网格。当我滚动数据网格超过 5 分钟时,会触发 IDLE 事件,这意味着如果我没有移动鼠标而只是使用滚动,则 idleCounter 会继续增加。如何在鼠标滚动时重置 idleCounter?
【问题讨论】:
标签:
apache-flex
actionscript
flex4
【解决方案1】:
您使用以下处理程序在应用程序上滚动:
protected function application1_scrollHandler(event:ScrollEvent):void
{
//dispatches a mouse move event to reset the idle timer
this.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_MOVE,true,false));
}
您可以使用以下语法将鼠标滚动处理程序添加到应用程序:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" minWidth="955" minHeight="600"
scroll="application1_scrollHandler(event)">