Changing movie clip colour

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?

You don’t have the ColorTransform class.

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

:slight_smile:

Thanks very much mate :slight_smile:

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

If you don’t know the number of clips:

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:

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

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…