0 Replies Latest reply on Jan 12, 2010 2:11 AM by Eveasau

    Want to automate SWF file generation for sounds

    Eveasau

      I am looking to automate our process of sound encoding.  This is for a game, which includes around 80mb of sound files, encoded as .mp3 files.

       

      The current solution is to do this:

       

      1. Add a sound to our sounds directory.

      2. Run our encoding script.

      3. Add the updated or new mp3 file to our sounds.SWF file.

      4. Use the file in our game, using a consts defined in an autogenerated .as file.

       

      The problem is really step 3, it requires that a human make choices, and add files to the SWF by hand.

      I've looked at using SWFTools, and have done the following:

       

      1. Using swfc, I've added a sound to the SWF, however when I then use the "AppDomain.getDefinition()" method, this fails to find the sounds by their names.

      2. I compiled the following code into an abc file, and added it as actions (DoABC) to the swf containing the sound file created in step 1.   In this case defining the sound as a class in the DoABC.  The following is the example of this:

       

      package
      {
          import flash.media.*;
          import flash.display.*;
      
          dynamic public class main extends MovieClip
          {
              public function main()
              {
                  super();
              }
          }
      
          dynamic public class windy_cityext_cue_a extends Sound
          {
      
              public function windy_cityext_cue_a()
              {
                  super();
                  return;
              }// end function
      
          }
      }
      

       

      This works up to a point, the following loader code then works halfway:

       

      var soundc:Class = m_domain.getDefinition("windy_cityext_cue_a") as Class;        

      var sound:flash.media.Sound = new soundc() as flash.media.Sound;

       

      in this case soundc and sound will construct, however the sound.length will show 0.  There will be no associated data with this sound.

       

      So what do I need to do to associate the sound's sample data with the class?  It's in the swf file, and it looks the same as the output from a hand created SWF generated by the Flash IDE.

       

      Any help here would be very much appreciated.