Hi!
I've an issue reported by a customer.
In my flex mobile app there is a function for playing external sound
obtained from a server.
The issue is: the app is running, audio work fine. then, the device go
in standby state. when I turn on the device, audio doesn't work.
please help me :)
sorry for my english!
thanks
federico
 
here my code:
 
private var soundLoading=false;
private var activeSound:SoundChannel;
 
  private function handleAudio(evt:MouseEvent):void
  {
   if(!soundLoading)
   {
    var request:String="http:\\www.foo.com\test.mp3";
    
    soundLoading=true;
          
    var s:Sound = new Sound();
    s.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
    s.addEventListener(Event.COMPLETE, onLoadComplete);
    s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
    
    var req:URLRequest = new URLRequest(request);
    s.load(req);
    
    if(activeSound!=null)
     activeSound.stop();
   }
  }
 
//----------------------------------------------------------------------
---------------------------
  private function onLoadProgress(event:ProgressEvent):void
  {
   var loadedPct:uint = Math.round(100 * (event.bytesLoaded /
event.bytesTotal));
   trace("The sound is " + loadedPct + "% loaded.");
  }
 
//----------------------------------------------------------------------
---------------------------
  private function onLoadComplete(event:Event):void
  {
   var localSound:Sound = event.target as Sound;
   activeSound=localSound.play();
   soundLoading=false;
  }
 
//----------------------------------------------------------------------
---------------------------
  private function onIOError(event:IOErrorEvent):void
  {
   trace("The sound could not be loaded: " + event.text);
   soundLoading=false;
  } 
 

Reply via email to