Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.

 

senocular.com ActionScript Library

invertRGB.as

Name: invertRGB() - inverts color
Author: senocular: www.senocular.com
Date: 1899-12-31T00:02:20.700
Documentation:
Color INVERTRGB: inverts a color object color.  

Example:
// interts the color of this clip when the mouse is down
onClipEvent(load){
	col = new Color(this);
	col.setRGB(0xff8822);
}
onClipEvent(mouseDown){
	col.invertRGB(); //invert
}
onClipEvent(mouseUp){
	col.invertRGB(); // unvert ;)
}

1
2
3
Color.prototype.invertRGB = function(){
	this.setRGB(0xffffff-this.getRGB());
}