2 Replies Latest reply on Apr 28, 2006 12:44 PM by TimSymons

    create sound

    WoBuHui Level 1
      Any one can teach me how to
      play a sound when button play click ,
      stop the sound when button stop click ,
      mute the sound when button mute click.,

      i try to use attach.sound() but it doesn't work...
      I need it urgently, is there anyone can help?
        • 1. Re: create sound
          Simon Bailey Level 1
          Have you got more code to show?

          Have you also got the sound in your library or loading it in externally?

          If in you library is it identified so actionscript can load it in accordingly?

          Check these points out dude and feed back and will see whats on!

          Simon
          • 2. Re: create sound
            TimSymons Level 1
            var gSound:Sound = new Sound();
            gSound.setVolume(100);
            gSound.attachSound( your_linakge_name_here);
            // or if you want to load an external sound then use gSound.load( url );

            playButton.onPress = function() {
            gSound.start();
            };

            stopButton.onPress = function() {
            gSound.stop();
            };

            muteButton.onPress = function() {
            if (gSound.getVolume == 0) {
            // already muted, turn back on
            gSound.setVolume(100);
            } else {
            // sound is on, now mute it
            gSound.setVolume(0);
            };


            This should get you started.

            Tim