actionscript鼠标停止几秒后的动作

      Flash学习 2006-1-16 9:33
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
}
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}