4 Replies Latest reply on Apr 15, 2008 10:18 PM by paulmason411

    Embedding sound in swf

      Hi Guys,

      I'm trying to make a drum beat in actionscript 3 using flex builder 2. I have imported the sound using this code:

      private var snd:Sound = new Sound();
      private var req:URLRequest = new URLRequest("cymbal.mp3");

      and initialize a timer with the code:

      private var tempoTimer:Timer = new Timer(1000,0);

      I then trigger the sound every 4 seconds by

      if (tempoTimer.currentCount == 4) {

      I can hear the sound file play, however it doesn't keep a consistent beat, basically the time between the beats aren't four seconds, it varies. It's easier to hear if you change the interval to 100 milliseconds.

      So I've assumed that it needs to be preloaded by containing the sound file in the swf. This can be done in flash using linkage, however i'm not sure if this is possible in flex builder. Is there a way that I can extract the code that flash creates with its linkage system?

      Any feedback would be great.