views:

41

answers:

1

I'm making a flash game, and I want to make a button. When I click on it, pause the music. When I click again, resume the music.

+2  A: 

You can do it this way

            private function stopMusic():void
        {
            _soundPosition = _soundChannel.position;
            _soundChannel.stop();
        }

        private function playMusic():void
        {
            _soundChannel = _sound.play( _soundPosition );
        }

When you stop, you save the current position, when you play, you play from the last saved position, if you set the _soundPosition propery to 0, the the play will do it from the beginning.

Avi Tzurel