ActionScript 3 Alpha 补间

发布于 2024-11-13 02:55:01 字数 1338 浏览 3 评论 0原文

我正在构建一个自定义预加载器,它与 RIA 中常见的“传统”滑动条不同。预加载器使用 100 个呈直线的白色激光灯,它们共同指示进度条。在我提出问题之前,让我先描述一下它是如何工作的:

........................,,,,,,,,,:: :::::::::::::::::::::::BBBBBBBB 等等...

上面的字符串捕获了预加载器指标的精髓。在此图中,角色越大越胖,我的实际预加载器中的激光越亮:

  1. 右侧最远的激光指示当前加载的百分比。这也是最亮的激光。
  2. 所有其他尾随激光都变得越来越暗,直到完全变黑,就好像它们在屏幕背面烧毁了整个一样。

步骤“2”是事情变得棘手的地方。由于某种原因,除了一些随机激光之外,试验激光并没有变暗。这是控制点的亮度(或者,当我使用它时,alpha 属性)的代码片段:

... more code ...

//Build the dots according the configuration and load status parameters
  private function buildDots(x:int, y:int):void {
  //Draw the dot, details not shown
    var dot:Shape = new Shape();

  //Begin the transitioning
    this.fadeOn(dot);
  }

//Fade a dot to full brightness
  private function fadeOn(dot:Shape):void {
    var fadeOn:Tween = new Tween(dot, "alpha", None.easeNone, 0, 1, this.fadeOnTime, true);

      fadeOn.addEventListener(TweenEvent.MOTION_FINISH, fadeOff);
  }

//Fade a dot to black
  private function fadeOff(e:TweenEvent):void {
    var fadeOff:Tween = new Tween(e.target.obj, "alpha", None.easeNone, 1, .2, this.fadeOffTime, true);
  }

... more code ...

有人可以告诉我哪里出错了吗?这些细节可能会有所帮助:

  1. 整个预加载器位于自定义类内部。
  2. 激光灯完全由代码创建,无需访问库。

如果我可以提供更多详细信息,请告诉我。我将奖励一个好的答案/反馈尽可能多的积分。

感谢您抽出宝贵的时间!

I am building a custom preloader which is different than the "traditional" sliding bar that is common in RIAs. The preloader uses 100 white laser lights which are in a straight line, and collectively they indicate the progress bar. Let me describe how this works before I ask my question:

........................,,,,,,,,,:::::::::::::::::::::::::BBBBBBBB and so on...

The above string captures the spirit of the preloader indicator. In this illustration, the bigger and fatter the character, the brighter the laser light in my actual preloader:

  1. The farthest laser to the right indicates the currently loaded percentage. This is also the brightest laser light.
  2. All other trailing lasers get increasingly dimmer until they become completely black, as if they had burned a whole in the back of the screen.

Step "2" is where things get tricky. For some reason, the trialing lasers do not get darker, except for a few random lasers. Here is a snippet of the code controlling the brightness (or, as I used it, the alpha property) of the dot:

... more code ...

//Build the dots according the configuration and load status parameters
  private function buildDots(x:int, y:int):void {
  //Draw the dot, details not shown
    var dot:Shape = new Shape();

  //Begin the transitioning
    this.fadeOn(dot);
  }

//Fade a dot to full brightness
  private function fadeOn(dot:Shape):void {
    var fadeOn:Tween = new Tween(dot, "alpha", None.easeNone, 0, 1, this.fadeOnTime, true);

      fadeOn.addEventListener(TweenEvent.MOTION_FINISH, fadeOff);
  }

//Fade a dot to black
  private function fadeOff(e:TweenEvent):void {
    var fadeOff:Tween = new Tween(e.target.obj, "alpha", None.easeNone, 1, .2, this.fadeOffTime, true);
  }

... more code ...

Could someone please show me where I am going wrong? These details may help:

  1. This entire preloader is inside of a custom class.
  2. The laser lights are created completely by code, without access to the library.

Please let me know if I can provide any more details. I will reward a good answer/feedback with as many points as I can.

Thank you for all your time!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把梦留给海 2024-11-20 02:55:01

我看到的是一个嵌入式函数。

我将使用 Greensock 中强大的 TweenMax 类重新编码。 http://www.greensock.com/tweenmax/

The thing I see is a embedded function.

I would recode using the powerful TweenMax classes from Greensock. http://www.greensock.com/tweenmax/

方觉久 2024-11-20 02:55:01

我临时看到的唯一一件事是您没有从 fadeOn 变量中删除事件侦听器。这是我要检查的第一件事 - 我对补间了解不多,但我确实知道您的事件侦听器将导致变量“fadeOn”存在的时间比应有的时间长,因为它有对它的引用。

不过,您可能需要发布更多代码。也许具有更多补间经验的人可以提供更多启发。

The only thing I'm seeing, offhand, is that you aren't removing an event listener from your fadeOn variable. That's the first thing I'd check out - I don't know much about tweening, but I do know that your event listener will cause the variable "fadeOn" to exist longer than it should, as it has a reference to it.

You might need to post more code, though. Perhaps someone with more tween experience can shed some more light.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文