早上好,我用 AIR for iOS 开发了一个简单的音板应用程序,但声音不起作用。我的意思是,当我打开应用程序时,我可以看到播放相关声音的按钮,但是当我按下按钮时,声音不会播放。
这是我的 AS3:
import flash.text.TextField;
//Array for buttons instances.
var buttonsArray:Array = new Array();
buttonsArray[0] = a01;
buttonsArray[1] = a02;
buttonsArray[2] = a03;
//Array for the sound clip names.
var soundArray:Array = new Array();
soundArray[0] = 'media/a01.mp3';
soundArray[1] = 'media/a02.mp3';
soundArray[2] = 'media/a03.mp3';
//This adds the mouse click event to the buttons.
for(var i:uint = 0; i < buttonsArray.length; i++){
buttonsArray[i].addEventListener(MouseEvent.CLICK, buttonClicked);
}
astop.addEventListener(MouseEvent.CLICK, stopButtonClicked);
//This function stops any sound clip that is playing and
//plays the sound file thats clicked.
function buttonClicked(e:MouseEvent):void{
SoundMixer.stopAll();
for(var i:uint = 0; i < buttonsArray.length; i++){
if(e.target == buttonsArray[i]){
var s:Sound = new Sound();
s.load(new URLRequest(soundArray[i]));
s.play();
}
}
}
//This function adds a stop button
function stopButtonClicked(e:MouseEvent):void{
SoundMixer.stopAll();
}
我在“AIR for iOS 设置...”中包含了“媒体”文件夹,但仍然无法正常工作。它出什么问题了?