《Flash Lite 2.x ActionScript 语言参考》 |
|
|
|
| ActionScript 语言元素 > 全局属性 > _soundbuftime 属性 | |||
_soundbuftime:Number = integer
确定要缓冲多少秒声音流。默认值是 5 秒。
integer:Number ― 在 SWF 文件开始进入流之前的秒数。
下面的示例先对 MP3 文件进行流式处理并缓冲声音,然后再为用户进行播放。在运行时会创建两个文本字段以保存计时器和调试信息。_soundbuftime 属性设置为将 MP3 缓冲 10 秒钟。将会为该 MP3 创建一个新的 Sound 对象实例。
// create text fields to hold debug information.
this.createTextField("counter_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
this.createTextField("debug_txt", this.getNextHighestDepth(), 0, 20, 100, 22);
// set the sound buffer to 10 seconds.
_soundbuftime = 10;
// create the new sound object instance.
var bg_sound:Sound = new Sound();
// load the MP3 sound file and set streaming to true.
bg_sound.loadSound("yourSound.mp3", true);
// function is triggered when the song finishes loading.
bg_sound.onLoad = function() {
debug_txt.text = "sound loaded";
};
debug_txt.text = "sound init";
function updateCounter() {
counter_txt.text++;
}
counter_txt.text = 0;
setInterval(updateCounter, 1000);
|
|
|
|