2010-02-03 26 views

回答

1

這對玩家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

祝您好運!