【发布时间】:2018-11-07 11:17:16
【问题描述】:
我正在尝试使用 as3 in air for android 制作一个数学应用程序。我有很多框架,上面有一些东西,比如
stop();
QuestText.text = "0+2"
Button1.LabelText.text = "6";
Button2.LabelText.text = "2";
Button3.LabelText.text = "0";
我有一些声音: 从 1.mp3 到 20.mp3 和 plus.mp3 和 minus.mp3
var DigitSound0:Sound = new Sound();
var DigitSound1:Sound = new Sound();
var DigitSound2:Sound = new Sound();
var DigitSound3:Sound = new Sound();
var DigitSound4:Sound = new Sound();
var DigitSound5:Sound = new Sound();
var DigitSound6:Sound = new Sound();
var DigitSound7:Sound = new Sound();
var DigitSound8:Sound = new Sound();
var DigitSound9:Sound = new Sound();
var DigitSoundplus:Sound = new Sound();
var DigitSoundminus:Sound = new Sound();
var DigitSoundChannel:SoundChannel = new SoundChannel();
DigitSound0.load(new URLRequest(FilePath+"speech/0.mp3"));
DigitSound1.load(new URLRequest(FilePath+"speech/1.mp3"));
DigitSound2.load(new URLRequest(FilePath+"speech/2.mp3"));
DigitSound3.load(new URLRequest(FilePath+"speech/3.mp3"));
DigitSound4.load(new URLRequest(FilePath+"speech/4.mp3"));
DigitSound5.load(new URLRequest(FilePath+"speech/5.mp3"));
DigitSound6.load(new URLRequest(FilePath+"speech/6.mp3"));
DigitSound7.load(new URLRequest(FilePath+"speech/7.mp3"));
DigitSound8.load(new URLRequest(FilePath+"speech/8.mp3"));
DigitSound9.load(new URLRequest(FilePath+"speech/9.mp3"));
DigitSoundplus.load(new URLRequest(FilePath+"speech/plus.mp3"));
DigitSoundminus.load(new URLRequest(FilePath+"speech/minus.mp3"));
我所需要的只是例如当问题是“4+5”时,让 as3 播放 4.mp3+plus.mp3+5.mp3
我可以在每一帧的每个 mp3 之后使用 soundcomplete 事件来做到这一点
stop();
DigitSoundChannel.addEventListener(Event.SOUND_COMPLETE, DigitSoundComplete);
DigitSoundChannel = DigitSound4.play();
function DigitSoundComplete(event:Event):void
{
ThemeSongChannel.removeEventListener(Event.SOUND_COMPLETE, DigitSoundComplete);
DigitSoundChannel = DigitSoundplus.play();
DigitSoundChannel.addEventListener(Event.SOUND_COMPLETE, DigitSoundComplete);
DigitSoundChannel = DigitSound5.play();
ThemeSongChannel.removeEventListener(Event.SOUND_COMPLETE, DigitSoundComplete);
}
QuestText.text = "4+5"
Button1.LabelText.text = "1";
Button2.LabelText.text = "0";
Button3.LabelText.text = "4";
但我有超过 300 帧。有没有更简单的方法?
【问题讨论】:
标签: android actionscript-3 flash audio air