繁体   English   中英

Air for iOS-声音

[英]air for ios - sound

早上好,我用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设置...”中包含了“媒体”文件夹,但仍然无法使用。 它出什么问题了?

解决了。 我只是将音频剪辑包含为.swc,并且一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM