zoukankan      html  css  js  c++  java
  • (转)as3 updateAfterEvent的作用

    http://milliybaby.iteye.com/blog/424776

    http://www.nshen.net/blog/article.asp?id=208

     .

    1.updateAfterEvent怎么用?
    有很多人做鼠标追随效果的时候,总是发现鼠标移动不流畅,不知该如何解决。
    其实方法很简单,你只需要加上一句updateAfterEvent()就ok了。

    2.先来看看帮助中是怎么解释as3的updateAfterEvent的:
    在 onClipEvent() 处理函数内调用updateAfterEvent函数时,或将其作为传递给 setInterval() 的函数或方法的一部分进行调用时,将更新显示(与为影片设置的每秒帧数无关)。如果对 updateAfterEvent 的调用不在 onClipEvent() 处理函数内,也不是传递给 setInterval() 的函数或方法的一部分,则 Flash 将忽略该调用。此函数只对某些 Mouse 和 MovieClip 处理函数起作用:Mouse 类的 mouseDown、mouseUp、mouseMove、keyDown 和 keyUp 处理函数;MovieClip 类的 onMouseMove、onMouseDown、onMouseUp、onKeyDown 和 onKeyUp 处理函数。它对 Key 类不起作用。

    3.其实说到底updateAfterEvent的作用就是使光标移动看起来更加顺畅。

    下面是updateAfterEvent的例子,目的让大家更方便的理解它的作用。
    当鼠标移到舞台左面的“有执行updateAfterEvent”的区域时,鼠标移动将流畅,而当鼠标移动到舞台右面的“无执行updateAfterEvent”的区域时,鼠标移动较会有间断,不流畅。

    看看as:

    //使用 updateAfterEvent() 继续刷新舞台以使光标的移动看起来顺畅。
    Mouse.hide();
    //trace(this)
    mymc.swapDepths(this.getNextHighestDepth());
    mymc.onMouseMove = function() {
    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;
    }
    }

  • 相关阅读:
    借书证信息管理系统,C语言实现
    以太坊 助记词提取 账户 公钥 私钥 最新实现可用。
    solc@0.6.3 web3@1.2.6 都是最新版本的,编译与部署示例
    ganache gas 错误
    MFC 记事本 文本编辑器
    课程设计 C语言 学生成绩管理系统
    cmake(.os .a)
    git recommend(alive)
    tensorflow tfrecoder read write
    300. 最长上升子序列
  • 原文地址:https://www.cnblogs.com/xbglbc/p/2050724.html
Copyright © 2011-2022 走看看