补间影片剪辑后的空白空间
这可能看起来有点模糊/令人困惑,但我希望你能明白。
我正在从 XML 填充数组。这些数组内部有动态文本字段,这些文本字段是影片剪辑的子级。
我补间了这个影片剪辑,因此使文本字段数组在舞台上一一呈现动画。 XML 有两种来源,一种来自实际站点,另一种来自硬盘中存储的 XML。首先,我填充文本字段数组,然后为影片剪辑设置动画。我对第一个执行此操作,然后对其进行动画处理,对第二个执行此操作,对其进行动画处理,对第一个执行此操作,对其进行动画处理,依此类推。
myTween = new Tween(mc,"x",None.easeNone,sizeOfStage,0 - mc.width,mcSpeedAuto,true);
我的补间以 0 - mc.width
结束>,问题是,如果我先补间 “更大的”XML,当下一个较小的 XML 被补间时,在它再次补间大的 XML 之前会有大量的空白空间(补间空白?)。
myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);
onFinish
我清除所有数组(否则第二个数组的补间仍然会有第一个数组的信息,例如:第一个有 25 个字段,第二个有 10 个字段,第一个显示有 25 个字段,第二个显示有 10 个字段,剩下的 15 个字段从第一个开始)并在第二个上调用补间。我认为通过这样做我也会清除所有的空白,显然不是。我认为 mc.width 只是保持“更大”的值,并始终以此进行补间,在第二种情况下需要更长的时间才能结束。我尝试将 mc.width 设置为每次填充数组时文本字段宽度的总和,但这也不起作用,所以我不太确定问题是什么:/
这是否太令人困惑了? 有什么想法吗?
提前致谢。
this may seem a bit vague/confusing but i hope you can get it.
I'm filling arrays from a XML. These arrays have dynamic textFields inside them, and these textFields are childs of a movieclip.
I tween this movieclip, therefore making the array of textFields animate on the stage one by one. There are two sources of XML, one from an actual site, and another from a XML stored in the hdd. First i fill the arrays of textFields, and then animate the movieclip. I do this for the first one, then animate it, do it again for the 2nd one, animate it, again for the 1st one, animate it, so on so on.
myTween = new Tween(mc,"x",None.easeNone,sizeOfStage,0 - mc.width,mcSpeedAuto,true);
my tween ends at 0 - mc.width
, the problem is, if i tween first the
"bigger" XML, when the next one which is smaller gets tweened, there's loads of empty space before it tweens the big one again (tweening whitespace?).
myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);
onFinish
i clear all the arrays (otherwise the tweening of the 2nd one would still have information of the 1st one e.g: 1st has 25 fields, second has 10, 1st shows it's 25 fields, 2nd shows 10, and the 15 that were left from from the 1st one) and call the tween on the 2nd one. I thought that by doing this i'd be clearing all that white space too, apparently not. I think the mc.width
just keeps the "bigger" value and always tweens with that, taking longer to end in the 2nd case. I've tried setting the mc.width as the sum of textfield width's everytime i fill the arrays, but this hasn't worked either, so i'm not quite sure what the problem is :/
Is this too confusing?
Any ideas?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
注意:使用默认 as3
Tween
类是废话。我这么说是因为很多时候补间会在完成动画之前被GC
收集(听起来这就是你的“空白”的来源) )。我建议一个新的补间器。关于哪种补间效果最适合性能有很多讨论,但当我的补间相当少时(就像你的例子),我个人倾向于轻松使用。
好的替代补间动画:
最后两个基于相同的引擎。有人说 Tweener 的性能较低,但我更喜欢它,因为它的原创性和易用性。 明智地选择!
**编辑 - 使用 Caurina Tweener 的示例 **
此外,这里是补间动画的过渡类型列表(单击补间即可查看其动画图播放)
Note: Using the default as3
Tween
class is bunk. I say that because a lot of times the tween will get collected by theGC
before it finishes the animation (which it sounds like that's where your "white space" is coming from).I suggest a new tweener. There's a lot of talk about which tweener best for performance, but I personally go for ease of when my tweens are fairly minimal (like your example).
Good replacement tweeners:
The last two are based on the same engine. There's talk of Tweener being low on the performance scale, but I prefer it per it's originality and ease-of-use. Choose wisely!
** edit - example using Caurina Tweener **
Also, here's a list of transition types for tweener (click on a tween to see it's animation graph play)