如何在Adobe Air 1.5中使用Javascript API跟踪Adobe Air中的鼠标光标位置变化?以下代码似乎对我不起作用。
var mainWin; //main stage
var _self={};
_self.mouse={x:0,y:0};
//Alias: air.MouseEvent=window.runtime.flash.events.MouseEvent;
mainWin.addEventListener(air.MouseEvent.MOUSE_MOVE,function(e){
_self.mouse.x=e.pageX;
_self.mouse.y=e.pageY;
});
我想要实现的是类似IM的状态更改准备聊天/离开。如果有其他方式,请告诉我。
答案 0 :(得分:0)
air.NativeApplication.nativeApplication.idleThreshold = 10; //10 seconds idle time
air.NativeApplication.nativeApplication.addEventListener(air.Event.USER_IDLE, function(event) {
//away
});
air.NativeApplication.nativeApplication.addEventListener(air.Event.USER_PRESENT, function(event) {
//back
});