Clearing Sound Position in AS2.0


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");
clipLength.text = soundTest.duration/1000+" s";
pauseClip.onPress = function() {
	pausePositionS = soundTest.position/1000;
startClip.onPress = function() {
	if (soundTest.position == soundTest.duration) {
	} else {
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: