# Color transform problem

**URL:** <https://forum.kirupa.com/t/color-transform-problem/120079>\
**Category:** Uncategorized\
**Created:** [August 20, 2004, 1:29pm UTC](https://forum.kirupa.com/t/color-transform-problem/120079 "2004-08-20T13:29:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![icestream](https://avatars.discourse-cdn.com/v4/letter/i/e19adc/32.png) [@icestream](https://forum.kirupa.com/u/icestream)\
**Post date:** [August 20, 2004, 1:29pm UTC](https://forum.kirupa.com/t/color-transform-problem/120079/1 "2004-08-20T13:29:20Z")

</div>

Hi,

I’m having a problem transforming the color of a movieclip. Until now I have this code:

```auto

var myColor:Color;

function init(Void):Void
{
	myColor = new Color(_root.mcColor);
}
	
var listenerObject:Object = new Object();

listenerObject.change = function(e)
{
  	switch(e.target)
	{
		case ra:
			setColorTransform(ra.value, ga.value, ba.value, aa.value);
		break;
		case ga:
			setColorTransform(ra.value, ga.value, ba.value, aa.value);
		break;
		case ba:
			setColorTransform(ra.value, ga.value, ba.value, aa.value);
		break;
		case aa:
			setColorTransform(ra.value, ga.value, ba.value, aa.value);
		break;
	}
}
ra.addEventListener("change", listenerObject);
ga.addEventListener("change", listenerObject);
ba.addEventListener("change", listenerObject);
aa.addEventListener("change", listenerObject);

function setColorTransform(ra:Number, ga:Number, ba:Number, aa:Number):Void
{
	var tempObject:Object = new Object();
	tempObject.ra = ra.toString();
	tempObject.rb = '0';
	tempObject.ga = ga.toString();
	tempObject.gb = '0';
	tempObject.ba = ba.toString();
	tempObject.bb = '0';
	tempObject.aa = aa.toString();
	tempObject.ab = '0';
	
	myColor.setTransform(tempObject);
}

```

It delivers no errors so nothing is wrong with the code, but the mc with an instance of mcColor won’t change it’s color when I click on the numeric stepper component. :sen:

thnx

---

<div class="post-metadata">

**Author:** ![icestream](https://avatars.discourse-cdn.com/v4/letter/i/e19adc/32.png) [@icestream](https://forum.kirupa.com/u/icestream)\
**Post date:** [August 20, 2004, 1:30pm UTC](https://forum.kirupa.com/t/color-transform-problem/120079/2 "2004-08-20T13:30:51Z")

</div>

Sorry I have allready found the problem 🙂 very stupid I forgot the call the init method. Sorry 😛 I’m used to java where the init is automatically called when an applet is started 🙂
