var cam1:Camera;
var cam2:Camera;
var cam3:Camera;
var cam4:Camera;

private var buttonDown:boolean;

private var allCams:Array = new Array();
allCams[0] = cam1;
allCams[1] = cam2;
allCams[2] = cam3;
allCams[3] = cam4;
	
private var currentCam:int = 0;
private var firstRun:boolean = true;

/**
 * Sets the active camera to the camera with index currentCam.
 */
function updateCameras():void {
	for( var i:int = 0; i < allCams.length; i++ ){
		allCams[i].enabled = (i == currentCam) ? true : false;
	}
}

function Update () {
	if(firstRun) {
		updateCameras();
		firstRun = false;
	}
	
	// when 'SwitchCamera' is pressed
	if( Input.GetButton("SwitchCamera") && !buttonDown ) {
		buttonDown = true;
		
		// update the cam we should be using
		currentCam++;
		if(currentCam >= allCams.length) currentCam = 0;
		
		// make that the only active camera
		updateCameras();
	}
	
	// when 'SwitchCamera' is released
	else if( !Input.GetButton("SwitchCamera") && buttonDown ) {
		buttonDown = false;
	}

}
