webguy23232
04-30-2009, 07:02 AM
Hello, I'm trying to load a mp3 player in my flex app and its not playing and I don't have any errors. Can someone assist me? Here is my code
<mx:Script>
<![CDATA[
import flash.display.MovieClip;
import flash.media.Sound;
import flash.events.Event;
import flash.net.URLRequest;
import flash.media.SoundChannel;
[Bindable]
private var _sound:Sound;
private var _soundChannel:SoundChannel;
private function initApp():void {
var _sound:Sound = new Sound();
var request:URLRequest = new URLRequest ("audio/Itrustyou.mp3");
_sound.load(request);
_sound.addEventListener(Event.COMPLETE,onLoad);
_soundChannel= _sound.play();
}
private function onLoad(event:Event):void{
}
private function sendInfo():void{
if(username.text=="" || email.text=="" || msg.text==""){
mx.controls.Alert.show("Please verify your form!")
} else {
contactService.send()
}
}
private function thanks(evt:Event):void{
if(String(contactService.lastResult)=="ok") currentState = "thanks"
else mx.controls.Alert.show("Errors sending email!")
}
]]>
</mx:Script>
<mx:Script>
<![CDATA[
import flash.display.MovieClip;
import flash.media.Sound;
import flash.events.Event;
import flash.net.URLRequest;
import flash.media.SoundChannel;
[Bindable]
private var _sound:Sound;
private var _soundChannel:SoundChannel;
private function initApp():void {
var _sound:Sound = new Sound();
var request:URLRequest = new URLRequest ("audio/Itrustyou.mp3");
_sound.load(request);
_sound.addEventListener(Event.COMPLETE,onLoad);
_soundChannel= _sound.play();
}
private function onLoad(event:Event):void{
}
private function sendInfo():void{
if(username.text=="" || email.text=="" || msg.text==""){
mx.controls.Alert.show("Please verify your form!")
} else {
contactService.send()
}
}
private function thanks(evt:Event):void{
if(String(contactService.lastResult)=="ok") currentState = "thanks"
else mx.controls.Alert.show("Errors sending email!")
}
]]>
</mx:Script>