Swapping properties

Hey guys. I just had a quick stupid question. I’m trying to write a code that switches back and forth between a certain color. If you click it, it turns green, if u click it again, it turns back to its normal color and so forth.

I tried just using a function in the timeline but it doesnt seem to be working:


function colorSwap() {
	switcher = 1;
	btnn.onRelease = function() {
		if(switcher = 1){	
			colorObj = new Color(MyMC1);
			colorObj.setTransform({ra:100, rb:-255,ga:100,gb:1,ba:100,bb:-255,aa:100,ab:0});
			switcher = 2;
		}
		else {
			colorObj = new Color(MyMC1);
			colorObj.setTransform({ra:100, rb:90,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0});
			switcher = 1;
		}
	}
}