Posted By

codism on 03/28/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

mecsekikrisztian


as3 textformat


 / Published in: ActionScript 3
 

  1. import flash.text.TextFormat
  2.  
  3. public var over_style = new TextFormat();
  4. public var out_style = new TextFormat();
  5.  
  6. over_style.color = 0xFF0000; // Red
  7. out_style.color = 0x0000FF; // Black
  8.  
  9. mcRolls.rollCount.text = "Hello World";
  10. mcRolls.rollCount.setTextFormat(out_style);
  11. mcRolls.rollCount.mouseEnabled = false; // This allows the hand to show up for dynamic textfields
  12. mcRolls.buttonMode = true;
  13. mcRolls.addEventListener(MouseEvent.MOUSE_OVER, OVER_Handler);
  14. mcRolls.addEventListener(MouseEvent.MOUSE_OUT, OUT_Handler);
  15.  
  16. function OVER_Handler(e:MouseEvent):void
  17. {
  18. var mc:MovieClip = e.currentTarget as MovieClip;
  19. mc.rollCount.setTextFormat(over_style);
  20. }
  21.  
  22. function OUT_Handler(e:MouseEvent):void
  23. {
  24. var mc:MovieClip = e.currentTarget as MovieClip;
  25. mc.rollCount.setTextFormat(out_style);
  26. }

Report this snippet  

You need to login to post a comment.