Posted By

sidneydekoning on 06/29/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

bazjapan
TrentSkunk


Changing the color of a piece of text onRollOver


 / Published in: ActionScript 3
 

  1. // 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:
  2. // In your button class
  3.  
  4. private function overState():void {
  5. var correctIndex:int = _label.text.toLowerCase( ).indexOf( "text i want to change color to" );
  6.  
  7. var tF:TextFormat = Fonts.getFormat( Fonts.AVANTGARDE );
  8. tF.color = 0xFFCC00;
  9. _label.setTextFormat( tF , correctIndex , _label.text.length );
  10. }
  11.  
  12. private function outState():void {
  13. var tF:TextFormat = Fonts.getFormat( Fonts.AVANTGARDE );
  14. tF.color = 0xCCFF00;
  15. _label.setTextFormat( tF );
  16. }

Report this snippet  

You need to login to post a comment.