影片剪辑上的音量淡出
我在网上浏览了这个问题,并提出了以下代码来淡出我的影片剪辑上的音量:
var myTransform = new SoundTransform();
myTransform.volume = 1;
loaderClip2[indexNumber].soundTransform = myTransform;
audioTween = new TweenLite(myTransform, 2, {volume:0});
我的影片剪辑存储在数组 loaderClip2
中,索引位置由变量确定索引号
。此代码不会产生所需的淡入淡出效果。谁能看出这里有什么问题吗?
I've looked around the net on this issue, and came up with the following code to fade out the volume on my movieclip:
var myTransform = new SoundTransform();
myTransform.volume = 1;
loaderClip2[indexNumber].soundTransform = myTransform;
audioTween = new TweenLite(myTransform, 2, {volume:0});
My movie clip is stored in the Array loaderClip2
at index position determined by the variable indexNumber
. This code does not produce the desired fade. Can anyone see what is the problem here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个代码:
<代码>
私有函数 updateChannel() : void {
var st : SoundTransform = new SoundTransform(loaderClip2[indexNumber].soundTransform.volume, 0 );
loaderClip2[indexNumber].soundTransform = st;
}
TweenLite.to(loaderClip2[indexNumber], 4, { 卷:.5, ease:Strong.easeInOut, onUpdate:updateChannel } );
设置您自己的参数
Try this code:
private function updateChannel() : void {
var st : SoundTransform = new SoundTransform(loaderClip2[indexNumber].soundTransform.volume, 0 );
loaderClip2[indexNumber].soundTransform = st;
}
TweenLite.to(loaderClip2[indexNumber], 4, { volume:.5, ease:Strong.easeInOut, onUpdate:updateChannel } );
Set your own parameters
好吧,伙计们,在尝试了 tweenlite 的所有可能方法之后,我使用老式的
ENTER_FRAME
事件找到了另一个解决方案。这是尽可能简单的,希望我之前就想到过:所以在前面的函数中我只是这样做:
然后稍后刷新事件函数(或任何它所谓的):
简单易行。
Alright guys, after trying everything possible with tweenlite, I figured out another solution using good-old-fashioned
ENTER_FRAME
events. This is as straight-forward as possible, wish I had thought of it before:so in a previous function I just do this:
and then later flush out the event function (or whatever it is called):
Easy as pie.