AS3声音,向前跳?

时间:2011-10-20 09:37:27

标签: actionscript-3

我正在播放as3中的循环声音,有没有办法跳转到某个声音的特定部分,比如当用户按下btn时播放时间为20秒?

1 个答案:

答案 0 :(得分:0)

假设您已经创建了Sound和SoundChannel对象。

private var mySound:Sound;
private var mySoundChannel:SoundChannel;

function onButtonClick(e:MouseEvent):void {
    var pos:Number = 0;
    if ( mySoundChannel ) {
        pos = mySoundChannel.position;
        mySoundChannel.stop();
    }
    //jump ahead 20 seconds, the play accepts time in ms
    mySoundChannel = mySound.play(pos + (20 * 1000));
}