0
對於我正在進行的項目,我需要能夠反向播放聲音對象。我如何能夠在AS3中做到這一點?我將如何去在Actionscript 3中反向播放聲音對象?
對於我正在進行的項目,我需要能夠反向播放聲音對象。我如何能夠在AS3中做到這一點?我將如何去在Actionscript 3中反向播放聲音對象?
這對玩家10是可行的,但它不是一個快速/簡單的實現。您必須構建自己的定製支持。讓我們來看看:
var soundSource:Sound; //assuming this actually references a real sound file such as a MP3
var position:int = soundSource.bytesTotal;
var numBytesToReadEachSample:int = 8192;
var snd:Sound = new Sound();
snd.addEventListener(SampleDataEvent.SAMPLE_DATA, sampleData);
snd.play();
function sampleData(e:SampleDataEvent):void {
position -= numBytesToReadEachSample;
//here we read data from our source, and write it to the playing sound
e.data.writeBytes(soundSource.extract(position, numBytesToReadEachSample))
}
這未測試和不完整的,但你想要做什麼的總體思路。希望它能指引你走向正確的方向!
點擊此處瞭解詳情:http://www.adobe.com/livedocs/flex/3/langref/flash/events/SampleDataEvent.html#SampleDataEvent%28%29
祝您好運!