Actionscript 3 在as3中连续播放wav声音
我正在尝试连续播放AS3外部wav声音。显而易见的方法是使用以下算法: 1.播放声音1 2.完成声音1后,播放声音2 等等 问题是我没有通过第2步(“当声音1完成”部分) 请只回答wav声音,而不是mp3 这是我的密码:Actionscript 3 在as3中连续播放wav声音,actionscript-3,external,wav,Actionscript 3,External,Wav,我正在尝试连续播放AS3外部wav声音。显而易见的方法是使用以下算法: 1.播放声音1 2.完成声音1后,播放声音2 等等 问题是我没有通过第2步(“当声音1完成”部分) 请只回答wav声音,而不是mp3 这是我的密码: package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.net.URLLoader; import flash.net.URLReq
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.utils.ByteArray;
import flash.media.Sound;
import org.as3wavsound.WavSound;
import org.as3wavsound.WavSoundChannel;
public final class Main extends Sprite
{
public final function Main():void
{
playB.addEventListener(MouseEvent.MOUSE_UP, loadWav);
}
private final function loadWav(e:MouseEvent):void
{
var urlRequest:URLRequest = new URLRequest('Phone.wav');
var wav:URLLoader = new URLLoader();
wav.dataFormat = 'binary';
wav.load(urlRequest);
wav.addEventListener(Event.COMPLETE, playWav);
}
private final function playWav(e:Event):void
{
var tts:WavSound = new WavSound(e.target.data as ByteArray);
tts.play();
}
}
}
(这当然是第一步)
Thanx尝试将您的声音放入“播放”命令返回的SoundChannel,然后收听完整的事件:
private final function playWav(e:Event):void
{
var tts:WavSound = new WavSound(e.target.data as ByteArray);
var channel:WavSoundChannel = tts.play();
channel.addEventListener(Event.SOUND_COMPLETE, completeHandler)
}
private function completeHandler(e:Event):void {
//play next sound
}
真的不行!Get me错误:1136:参数数不正确。应为5。错误在第32行。我正在发送代码的最后一部分:31私有最终函数playWav(e:Event):void 32{31 var tts:WavSound=new WavSound(e.target.data as ByteArray);32 var channel:WavSoundChannel=new WavSoundChannel();33 channel=tts.play();34}35}36}其余的代码与我的示例中的代码相同。您正在实例化WavSoundChannel,但不需要这样做。play()方法返回已实例化的WavSoundChannel