2 Replies Latest reply on Jan 15, 2009 5:39 AM by Newsgroup_User

    Actionscript 2.0/Flash 8: Starting sounds issue.

    Level 7
      Greetings,

      I have a function that displays a explosion movie clip and plays a sound.

      The bigger the movie clip the more times the explosion function is called,
      this can result in the sound being played multiple
      times within a short space of time.

      The sound is attached and played as below

      var ExplosiveSound:Sound = new Sound();
      ExplosiveSound.attachSound("Explosivesound");
      _root.ExplosiveSound.start()

      I've discovered since if the sound is started again the previous sound is
      cut off for another to be started.

      I discovered the OnSoundComplete method but was unable to work out how I
      could use this to ensure that the sound is played in its entirety i.e. If a
      sound is currently being played do not start another one.

      How is it possible to ensure if a explosion sound is currently be played
      that another is not started?

      Thanks
      Rob


        • 1. Re: Actionscript 2.0/Flash 8: Starting sounds issue.
          Level 7
          I've done this as a workaround (see code below) are there any better
          recommendations/solutions?

          if (z == 0)
          {
          z=1;
          _root.ExplosiveSound.start();
          }


          _root.ExplosiveSound.onSoundComplete = function()
          {
          z=0;
          }


          "Rob W" <Whllrob@aol.com> wrote in message
          news:gkn14b$rc5$1@forums.macromedia.com...
          > Greetings,
          >
          > I have a function that displays a explosion movie clip and plays a sound.
          >
          > The bigger the movie clip the more times the explosion function is called,
          > this can result in the sound being played multiple
          > times within a short space of time.
          >
          > The sound is attached and played as below
          >
          > var ExplosiveSound:Sound = new Sound();
          > ExplosiveSound.attachSound("Explosivesound");
          > _root.ExplosiveSound.start()
          >
          > I've discovered since if the sound is started again the previous sound is
          > cut off for another to be started.
          >
          > I discovered the OnSoundComplete method but was unable to work out how I
          > could use this to ensure that the sound is played in its entirety i.e. If
          > a sound is currently being played do not start another one.
          >
          > How is it possible to ensure if a explosion sound is currently be played
          > that another is not started?
          >
          > Thanks
          > Rob
          >


          • 2. Re: Actionscript 2.0/Flash 8: Starting sounds issue.
            Level 7
            Quick note to say I'm now using a boolean as better suited (true/false).

            "Rob W" <Whllrob@aol.com> wrote in message
            news:gkndu1$dlq$1@forums.macromedia.com...
            > I've done this as a workaround (see code below) are there any better
            > recommendations/solutions?
            >
            > if (z == 0)
            > {
            > z=1;
            > _root.ExplosiveSound.start();
            > }
            >
            >
            > _root.ExplosiveSound.onSoundComplete = function()
            > {
            > z=0;
            > }
            >
            >
            > "Rob W" <Whllrob@aol.com> wrote in message
            > news:gkn14b$rc5$1@forums.macromedia.com...
            >> Greetings,
            >>
            >> I have a function that displays a explosion movie clip and plays a sound.
            >>
            >> The bigger the movie clip the more times the explosion function is
            >> called, this can result in the sound being played multiple
            >> times within a short space of time.
            >>
            >> The sound is attached and played as below
            >>
            >> var ExplosiveSound:Sound = new Sound();
            >> ExplosiveSound.attachSound("Explosivesound");
            >> _root.ExplosiveSound.start()
            >>
            >> I've discovered since if the sound is started again the previous sound is
            >> cut off for another to be started.
            >>
            >> I discovered the OnSoundComplete method but was unable to work out how I
            >> could use this to ensure that the sound is played in its entirety i.e. If
            >> a sound is currently being played do not start another one.
            >>
            >> How is it possible to ensure if a explosion sound is currently be played
            >> that another is not started?
            >>
            >> Thanks
            >> Rob
            >>
            >
            >