有很多人做鼠标追随效果的时候,总是发现鼠标移动不流畅,不知该如何解决。
其实方法很简单,你只需要加上一句updateAfterEvent()就ok了。
先来看看帮助中是怎么解释updateAfterEvent的:
/*在 on
其实说到底updateAfterEvent的作用就是使光标移动看起来更加顺畅。
下面是我做的一个对比的例子,目的让大家更方便的理解它的作用。
当鼠标移到舞台左面的“有执行updateAfterEvent”的区域时,鼠标移动将流畅,而当鼠标移动到舞台右面的“无执行updateAfterEvent”的区域时,鼠标移动较会有间断,不流畅。
Flash动画
看看as:
//使用 updateAfterEvent() 继续刷新舞台以使光标的移动看起来顺畅。
Mouse.hide();
//trace(this)
mc.swapDepths(this.getNextHighestDepth());
mc.on
if(this.hitTest(you)){
this._x = this._parent._xmouse;
this._y = this._parent._ymouse;
updateAfterEvent();
}
if(this.hitTest(wu)){
this._x = this._parent._xmouse;
this._y = this._parent._ymouse;
}
}