【 tulaoshi.com - Flash 】
简单的检测鼠标是否有移动的类 class MouseMove extends MovieClip {
private var _nx:Number;
private var _ny:Number;
private var _ox:Number;
private var _oy:Number;
public function isMoving():Boolean {
_nx = _level0._xmouse;
_ny = _level0._ymouse;
if ((_nx-_ox)!=0 || (_ny-_oy) != 0) {
_ox = _nx;
_oy = _ny;
return true;
}
return false;
}
} // 测试程序
import MouseMove;
var m_obj:MouseMove = new MouseMove();
onEnterFrame = function() {
if (m_obj.isMoving()) {
trace("mouse is moving");
} else {
trace("mouse is stop");
}
};