本文介绍了问题在指定的位置开始声音(AS2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个ActionScript 2件code的一个问题。我试图加载一首歌曲,并开始在第50秒,直到结束播放。
I have an issue with an Actionscript 2 piece of code. I'm trying to load a song and start playing it at the 50th second until the end.
var song:Sound = new Sound();
song.setVolume(100);
song.loadSound(songToPlay,true); // songToPlay is a valid path
song.start(50);
这载荷和播放声音,但在开始时,而不是在50秒像我想要的。我也试过
This loads and play the Sound, but at the begining and not at 50 seconds like I want. I also tried
song.start(50,1);
没有成功。
我在做什么错了?
推荐答案
为了在特定的时间来启动一个声音文件,你有它的完成加载(或至少装过去那点)后,启动它。
In order to start a sound file at a specific time, you have to start it after it's finished loading (or at least loaded past that point).
尝试是这样的:
var song:Sound = new Sound();
song.setVolume(100);
song.onLoad = function(success:Boolean)
{
if (success)
{
song.start(50);
}
};
song.loadSound(songToPlay,true);
这篇关于问题在指定的位置开始声音(AS2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!