# Swapping properties

**URL:** https://forum.kirupa.com/t/swapping-properties/85630
**Category:** Uncategorized
**Created:** [April 6, 2005, 5:43am UTC](https://forum.kirupa.com/t/swapping-properties/85630 "2005-04-06T05:43:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tempest811](https://avatars.discourse-cdn.com/v4/letter/t/e480ec/32.png) [@Tempest811](https://forum.kirupa.com/u/Tempest811)
#### Post date: [April 6, 2005, 5:43am UTC](https://forum.kirupa.com/t/swapping-properties/85630/1 "2005-04-06T05:43:44Z")

</div>

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:

```auto

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;
		}
	}
}

```
