我只有一个音频文件,我想避免将其剪切。
我知道我可以使用声音类 mySound.play(150)
,从 150 毫秒开始,但还没有找到在 500 毫秒或 650 毫秒后停止音频的方法。
感谢任何输入。
最佳答案
您可以使用进入帧事件来检查 SoundChannel 位置 - SoundChannel .一旦位置大于或等于您的时间码,停止声音。这当然不会非常准确,并且取决于应用程序的帧速率。
var mySound:Sound = new Sound(); var channel:SoundChannel = new SoundChannel(); addEventListener(Event.ENTER_FRAME, loop); channel = mySound.play(150); function loop(e:Event):void { if (channel.position >= 500) { channel.stop(); } }
关于flash - AS3 从音轨中间开始和停止音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5779586/