Show hide Movie Clip help

Hi, I could someone please help me with a simple flash game I am trying to make, it involves someone pressing a button which generates a random number between 1 and 2, and depending on which number two images are displayed, “heads” and “tails”. Any help is much appricated as I am fairly new to flash and fourms, thank you.

This is what I have so far on the button

on (release) {
var numCoin = random(2) + 1;
if (numCoin = 1) {
heads._visible = false;
tails._visible = true;
}else{
heads._visible = true;
tails._visible = false
}

}

Thank you