国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > Flex > 正文

flex SystemManger監(jiān)控用戶(hù)是否和程序打交道

2024-09-12 17:51:11
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
例如:
var sysMan:SystemManager = Application.application.systemManager;
sysMan.removeEventListener(FlexEvent.IDLE, timeoutHandler);
// timeout after twenty seconds
public var timeout:Number = 20000;
private var timeoutTotal:Number = 0;
private var timeoutLastCall:Number;
public var sessionExpired:Boolean = false;
public var enableTimeout:Boolean = true;
private function timeoutHandler(event:FlexEvent):void
{
// get current time
var curTime:int = getTimer();
var timeDiff:int = 0;
if (isNaN(timeoutLastCall)) {
timeoutLastCall = curTime;
}
timeDiff = curTime - timeoutLastCall;
timeoutLastCall = curTime;
// if time has passed since the idle event we assume user is interacting
// reset time total - otherwise increment total idle time
if (timeDiff > 1000) {
timeoutTotal = 0;
}
else {
// update time
// the status field will not be updated unless the application is idle
// it is only display a countdown for learning purposes
timeoutTotal += 100;
status.text = "Timeout in " + String(Number((timeout - timeoutTotal)/1000).toFixed(0)) + " seconds";
}
// if the total time of inactivity passes our timeout
// and the session already hasn't expired then logout user
if (timeoutTotal > timeout && !sessionExpired) {
// logout user
// or set flag
sessionExpired = true;
status.text = "timeout threshold has been reached";
//當(dāng)時(shí)間超過(guò)之后執(zhí)行的語(yǔ)句
sessionTimeoutHandler();
}
}
發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 浮梁县| 图们市| 定远县| 金堂县| 巫山县| 社会| 菏泽市| 奇台县| 新蔡县| 蓬溪县| 佛教| 阿拉尔市| 禄丰县| 平武县| 沅江市| 建宁县| 邮箱| 灵武市| 大邑县| 安国市| 福贡县| 资源县| 榆中县| 康马县| 宝坻区| 灯塔市| 长泰县| 蓝山县| 平果县| 靖江市| 新沂市| 临江市| 呼伦贝尔市| 衡水市| 龙山县| 藁城市| 温泉县| 临猗县| 龙口市| 云霄县| 乌海市|