If else statement Please help

i am using actionscript to loop a music file

bgSound = new Sound(this);
bgSound.attachSound("sound1");
bgSound.start(0,99);
bgSound.setVolume(36);

Which is working fine.

In my flash stage i have two button

  1. Start Button
    2.Stop Button

To Start & stop the sound i have used



stopB.onRelease = function() {
bgSound.stop();
};

playB.onRelease = function() {
        bgSound.start(0,99);
    }
};

Which is also working fine. But whenever i am click the start button twice or more the sound is repeating many times which is really anoying.

so i was using a if else state


playB.onRelease = function() {
if(bgSound.stop==true)
        bgSound.start(0,99);
    }
};

I am very bad at AS please help me.

var songplay = 1;
stopB.onRelease = function() {
	songplay = 0;
	bgSound.stop();
};
playB.onRelease = function() {
	if (!songplay) {
		bgSound.start(0, 99);
		songplay = 1;
	}
};

scotty(-:

thank you scotty

you’re welcome=)