1 Reply Latest reply on Jan 11, 2010 7:35 AM by Sebastien V.

    Basic streaming of mp3 file example

    The Converted



      I'm just trying to understand how to work with sound.  Although you can find many mp3 player codes available to use it's difficult to customize them if don't really know what's going on. So I set about looking at the sound examples in the help menu of flex development.  The following code below is supposed to take an mp3 file and stream it.


      But the error get is "-1120- access of undefined property s , req and context  " on lines where those are used.  I don't even know what req and context mean but they seem to be defined, so I don't get what I'm missing and why it won't work?  Please put me out of my misery.  I'm saving it as an mxml file.



      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
          import flash.media.Sound;
      import flash.media.SoundLoaderContext;
      import flash.net.URLRequest;


      var s:Sound = new Sound();
      var req:URLRequest = new URLRequest("pride.mp3");
      var context:SoundLoaderContext = new SoundLoaderContext(8000, true);
      s.load(req, context);