Clearing Sound Position in AS2.0

Hi,

I’m building an e-learning package and I’m using Play/Pause buttons for voiceovers for different movie clips. I have separate movie clips for slides and a separate layer for the audio functions. Here’s my script:

soundTest = new Sound();
soundTest.attachSound("slide 1");
soundTest.start();
clipLength.text = soundTest.duration/1000+" s";
pauseClip.onPress = function() {
	pausePositionS = soundTest.position/1000;
	soundTest.stop();
};
startClip.onPress = function() {
	if (soundTest.position == soundTest.duration) {
		soundTest.start();
	} else {
		soundTest.start(pausePositionS);
	}
};
startClip.onEnterFrame = function() {
	currentPosition.text = soundTest.position/1000;
};


When ‘startClip’ is pressed, it triggers the pausePositionS function - the sound plays from where it was paused as programmed in pausePositionS function. The catch is that when I resume playback after pausing, it’s working fine. However, if I ‘repress’ the play button, it duplicates the playback from pausePositionS time again, resulting in 2 copies. The ‘n’ number of times I press play, the ‘n’ number of times it starts playing back again!

Even though people won’t really click on the Play button more than once, some people like ME would just want to experiment and report bugs! I want to avoid this.

Your replies will be appreciated! :thumb:

Cheers…
Sudarshan