Hi everyone, so I've got a problem, I am making some play btns that will play a sound when it's pressed,
I have the mp3 file in some folder that i refer to in the code:
it plays well when testing, but when i "publish" the app as an .ipa and put it in my iPhone the play button doesn't work,
and i added the folders to the app exactly as it is in the code, which is this:
Random_btn.addEventListener(MouseEvent.CLICK, playRandomSound);
var random_sound:Sound = new Sound();
random_sound.load(new URLRequest("random/randomness/randomsound.mp3"));
var my_randomchannel:SoundChannel = new SoundChannel();
function playRandomjSound(event:MouseEvent):void{
my_randomchannel = random_sound.play();
}
function stopSound(event:MouseEvent):void{
my_randomchannel.stop();
}
Any reason why it shouldn't play that i dont know?
I reapeat i added the "random" folder with the "randomness" sub folder with the "randomsound.mp3" file to the app in the AIR iOS settings..
Thanks for any responses to help ![]()
Try to use the File class to reference the file.
var randFile:File = File.applicationDirectory.resolvePath("/random/randomness/randomsound .mp3");
// exist?
if (randFile.exists)
{
var random_sound:Sound = new Sound();
random_sound.load(new URLRequest(randFile.nativePath));
// etc
}
North America
Europe, Middle East and Africa
Asia Pacific