Return to Snippet

Revision: 15246
at June 29, 2009 06:16 by sidneydekoning


Initial Code
// Most of the time when you have a checkbox with a label and  link in that label, you just want to change the color of that link on rollOver or rollOut. Here is how:
// In your button class

private function overState():void {
	var correctIndex:int = _label.text.toLowerCase( ).indexOf( "text i want to change color to" );
			
	var tF:TextFormat = Fonts.getFormat( Fonts.AVANTGARDE );
	tF.color = 0xFFCC00;
	_label.setTextFormat( tF , correctIndex , _label.text.length );
}
		
private function outState():void {
	var tF:TextFormat = Fonts.getFormat( Fonts.AVANTGARDE );
	tF.color = 0xCCFF00;
	_label.setTextFormat( tF );
}

Initial URL


Initial Description


Initial Title
Changing the color of a piece of text onRollOver

Initial Tags


Initial Language
ActionScript 3