2011-10-20 51 views
0

我在as3中播放循环声音,有没有办法跳到特定的声音部分,比如在播放过程中用户按下btn时的20秒?AS3声音,向前跳?

回答

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)); 
}