Posted By

antpaw on 01/28/09


Tagged

css flash


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

liamr
enajenkins
vip4lyf
KDR
Pingpongbal
TrentSkunk


CSS for styling text in flash with nonstandard fonts


 / Published in: ActionScript 3
 

dont use spaces around the ":" in CSS its buggy :(

  1. //css:
  2. p{
  3. font-family:Caecilia LT Std 55 Roman;
  4. font-size:35;
  5. leading:10;
  6. color:#252525;
  7. }
  8. .veryBig{
  9. font-family:Caecilia LT Std 86 Heavy Italic;
  10. font-size:77;
  11. }
  12. .bigOrange{
  13. font-family:Caecilia LT Std 45 Light;
  14. font-size:53;
  15. color:#d55c19;
  16. }
  17. .bigBold{
  18. font-family:Caecilia LT Std 85 Heavy;
  19. font-size:53;
  20. }
  21. .normalThin{
  22. font-family:Caecilia LT Std 46 Light Italic;
  23. }
  24. .bigThin{
  25. font-family:Caecilia LT Std 45 Light;
  26. font-size:58;
  27. }
  28.  
  29. //ac3:
  30. var url:URLRequest = new URLRequest("style.css");
  31. var loader:URLLoader = new URLLoader();
  32. loader.addEventListener(Event.COMPLETE, cssComplete);
  33. loader.load(url);
  34.  
  35. function cssComplete(evt:Event){
  36. var css:StyleSheet = new StyleSheet();
  37. css.parseCSS(loader.data);
  38. wellcText.styleSheet = css;
  39. wellcText.htmlText = "<p><span class='veryBig'>Hello</span>, some text <span class='bigOrange'>some text</span>.<br>some text <span class='normalThin'>some text</span> my <span class='bigBold'>some text</span><br>some text <span class='bigBold'>some text</span><br>some text <span class='normalThin'>some text</span> some text <span class='bigThin'>some text</span>.</p>";
  40. wellcText.embedFonts=true;
  41. wellcText.selectable=false;
  42. }

Report this snippet  

You need to login to post a comment.