actionscript鼠标停止几秒后的动作代码
作者:aiwen 日期:2008-06-10
actionscript鼠标停止几秒后的动作代码
AS学堂 2006-10-30 20:18
actionscript鼠标停止几秒后的动作代码
var mouseListener:Object = {};
var stillFor = 5000//停止的时间,你可以自己定义
mouseListener.onMouseMove = function ():Void {
if (this.timer) {
clearInterval (this.timer);
trace("你的鼠标动了");
//your code here:
//what to do onMouseMove
}
this.timer = setInterval (_root, "mouseTimeout", stillFor, this);
};
Mouse.addListener (mouseListener);
function mouseTimeout (listener:Object):Void {
clearInterval (listener.timer);
trace("你已停止5秒了");
//your code here:
//what to do after 5 sec (stillFor) of mouse inactivity
AS学堂 2006-10-30 20:18
actionscript鼠标停止几秒后的动作代码
var mouseListener:Object = {};
var stillFor = 5000//停止的时间,你可以自己定义
mouseListener.onMouseMove = function ():Void {
if (this.timer) {
clearInterval (this.timer);
trace("你的鼠标动了");
//your code here:
//what to do onMouseMove
}
this.timer = setInterval (_root, "mouseTimeout", stillFor, this);
};
Mouse.addListener (mouseListener);
function mouseTimeout (listener:Object):Void {
clearInterval (listener.timer);
trace("你已停止5秒了");
//your code here:
//what to do after 5 sec (stillFor) of mouse inactivity
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: