I am trying to play a sound clip which is on the root of my .fla called "MyWord.mp3"
I have the URL inside of an XML file which I've loaded
Here is the code which accesses and plays on click of the soundbtn
var soundBtn:soundbtn = new soundbtn();
soundBtn.height = 22;
soundBtn.scaleX = soundBtn.scaleY;
soundBtn.addEventListener(MouseEvent.CLICK, PlayAu);
function PlayAu(event:MouseEvent):void{
var SoundChnl:SoundChannel = new SoundChannel();
var SoundFile:Sound = new Sound();
SoundFile.load(new URLRequest(AudioLO));
SoundFile.addEventListener(Event.COMPLETE, onComplete,false,0,true);
function onComplete(e:Event):void{
SoundChnl = SoundFile.play();
}
}
addChild(soundBtn);
However I get an error on my "var SoundFile:Sound = new Sound();" line saying
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
For reference here is the xml file line entry
<wordgroup>
<englishword>Mother</englishword>
<languageword>Wee-Ung</languageword>
<pronouciation>Wee - Young</pronouciation>
<audio>"MyWord.mp3"</audio>
</wordgroup>
No comments:
Post a Comment