国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 灵台县| 若羌县| 富平县| 河间市| 谢通门县| 文山县| 聂拉木县| 岱山县| 临城县| 龙州县| 三河市| 抚远县| 光山县| 安康市| 花莲市| 台湾省| 贵德县| 阿克苏市| 金平| 洱源县| 湘潭县| 怀柔区| 临潭县| 浦城县| 翁源县| 德庆县| 资中县| 瓦房店市| 许昌市| 仁布县| 留坝县| 左云县| 成都市| 利津县| 新建县| 吐鲁番市| 沂南县| 游戏| 巴中市| 来安县| 房产|