Playing external sound (iOS app)
hi everyone, i've got problem, making play btns play sound when it's pressed,
i have mp3 file in folder refer in code:
it plays when testing, when "publish" app .ipa , put in iphone play button doesn't work,
and added folders app in code, 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 shouldn't play dont know?
i reapeat added "random" folder "randomness" sub folder "randomsound.mp3" file app in air ios settings..
thanks responses
try use file class reference 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
}
More discussions in ActionScript 3
adobe
Comments
Post a Comment