2 Replies Latest reply on Mar 1, 2007 6:36 AM by webjoseph


      I am working on a Training program where a flex program is a course player.

      The course itself, I am looking at also building in flex, to handle buttons, popups, etc
      my test application just has:

      <mx:SWFLoader x="10" y="133" width="800" height="600" >

      The testcourse is just some image and text, and it works fine.
      I added audio to it, by:

      public function SoundExample() {
      var url:String = "Audio/001.mp3";
      var song:SoundChannel;
      var request:URLRequest = new URLRequest(url);
      var soundFactory:Sound = new Sound();
      soundFactory.addEventListener(Event.COMPLETE, completeHandler);
      soundFactory.addEventListener(Event.ID3, id3Handler);
      soundFactory.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
      soundFactory.addEventListener(ProgressEvent.PROGRESS, progressHandler);
      song = soundFactory.play();

      and called on it by:
      <mx:Image x="0" y="0" width="800" height="600" source="Images/masterframe.jpg" scaleContent="true" autoLoad="true" creationComplete="SoundExample();"/>

      I can play the test course from Flex Builder and double click the swf file in the bin folder, the image comes up and the audio plays. From the TestPlayer, the audio doesn't.


        • 1. Re: swfloader
          veritech1985 Level 1
          I got it, I needed to put an absolute path for the audio file. The player was loading the swf, the swf called on the audio file that didn't exist in the path of the player.

          so, I embedded the audio into the file.

          It's working fine

          I wouldn't mind other suggestions on other things that I might run into. Like how to send communication back and forth. ie. when the audio is finished playing, I need to let the player know so it can display the next and previous buttons

          • 2. Re: swfloader
            When the audio completes, it will throw an event. Create an event listener for "soundComplete" and tie it to a function for it to do something with that event ("onSoundFinish()").


            courseAudio.addEventListener(Event.SOUND_COMPLETE, onComplete);

            Probably more information in documentation of the following package that will be more helpful: