Enable Camera movment on/off with one button

This is a slightly different situation than What I have been able to find. I want to press ‘m’ and open up a gui menu but disable camera movment in my multiplayer game. I am close but not quite there with it. I want to hit ‘m’ open the menu (which I have done) and hit 'm’again and close it. While the menu is open freeze the camera movements. Here is what I have:

var openMenu : boolean = false;
var mouseMove : boolean = true;

function Update () {

if (networkView.isMine){

 if (mouseMove == false)
    	{
    	myCamera.GetComponent("MouseLook").enabled=false;
    	}
    
     if (Input.GetKeyDown ("m"))
	 {
	   
	 	openMenu=!openMenu;
	 	mouseMove = !mouseMove;
	 	
	
  	 }
}

I am not sure how to enable and disable off of just one button. Thanks for the help guys!

Try using get key up instead, since keyDown may cycle those booleans multiple times. With ‘keyUp’ you know it will only get called once.

 if (Input.GetKeyUp("m"))
 {
      openMenu=!openMenu;
      mouseMove = !mouseMove;
 }

and then this part needs to enable the component as well

 var mouseLook:MouseLook=myCamera.GetComponent(MouseLook);
 if (mouseMove == false)
 {
     mouseLook.enabled=false;
 }
 else if(!mouseLook.enabled)
 {
     mouseLook.enabled=true;
 }