# Changing movie clip colour

**URL:** <https://forum.kirupa.com/t/changing-movie-clip-colour/204977>\
**Category:** flash\
**Created:** [October 25, 2006, 2:54am UTC](https://forum.kirupa.com/t/changing-movie-clip-colour/204977 "2006-10-25T02:54:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oli\_G](https://avatars.discourse-cdn.com/v4/letter/o/f05b48/32.png) [@Oli\_G](https://forum.kirupa.com/u/Oli_G)\
**Post date:** [October 25, 2006, 2:54am UTC](https://forum.kirupa.com/t/changing-movie-clip-colour/204977/1 "2006-10-25T02:54:00Z")

</div>

Hi all

Just trying to change the colour of a clip via as on rollover, but no dice!!

b1\_mc.onRollOver = function() {  
colorTrans.rgb = 0x5FBEFE; // blue  
trans.colorTransform = colorTrans;  
};

b1\_mc.onRollOut = function() {  
colorTrans.rgb = 0x139FFD; // blue  
trans.colorTransform = colorTrans;  
};

any ideas?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [October 25, 2006, 3:12am UTC](https://forum.kirupa.com/t/changing-movie-clip-colour/204977/2 "2006-10-25T03:12:35Z")

</div>

You don’t have the ColorTransform class.

```auto
b1_mc.colour = new Color(b1_mc);
b1_mc.onRollOver = function():Void {
       this.colour.setRGB(0x5FBEFE);
}
b1_mc.onRollOut = function():Void {
       this.colour.setRGB(0x139FFD);
}

```

🙂

---

<div class="post-metadata">

**Author:** ![Oli\_G](https://avatars.discourse-cdn.com/v4/letter/o/f05b48/32.png) [@Oli\_G](https://forum.kirupa.com/u/Oli_G)\
**Post date:** [October 25, 2006, 3:34am UTC](https://forum.kirupa.com/t/changing-movie-clip-colour/204977/3 "2006-10-25T03:34:08Z")

</div>

Thanks very much mate 🙂

One final thing if anyone can help, the number of clips will vary quite a lot. All named b1, b2, etc etc.

for (i) {  
if (typeof (this\*) == ‘b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15’) {

this.onRollOver = function(){this.colour.setRGB(0x5FBEFE)}  
this.onRollOut = function(){this.colour.setRGB(0x139FFD)}  
}  
}

Going nowvere (obviously), if anyone can fill in the gaps that’d be great.

Or, point me to a relevant tute in loops… something ive always avoided :s

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [October 25, 2006, 4:00am UTC](https://forum.kirupa.com/t/changing-movie-clip-colour/204977/4 "2006-10-25T04:00:23Z")

</div>

If you don’t know the number of clips:

```auto
this.i = 0;
while(this["b" + (i++)]) {
	this["b" + i].onRollOver = function():Void {
		//actions
	}
	this["b" + i].onRollOut = function():Void {
		//actions
	}
}
delete this.i;

```

If you do:

```auto
this.i = 0;
while (this.i++ < numberOfClips) {
	this["b" + i].onRollOver = function():Void {
		//actions
	}
	this["b" + i].onRollOut = function():Void {
		//actions
	}
}
delete this.i;

```

---

<div class="post-metadata">

**Author:** ![Oli\_G](https://avatars.discourse-cdn.com/v4/letter/o/f05b48/32.png) [@Oli\_G](https://forum.kirupa.com/u/Oli_G)\
**Post date:** [October 25, 2006, 4:12am UTC](https://forum.kirupa.com/t/changing-movie-clip-colour/204977/5 "2006-10-25T04:12:54Z")

</div>

Thanks Canadian, the number of clips varies so much i’m using the former! Not getting any love though, they’re not being recognised as rollovers?

Everything is currently sitting in a container clip on seperate layers, on one frame…
