# CSS styling from AS not external file

**URL:** <https://forum.kirupa.com/t/css-styling-from-as-not-external-file/226692>\
**Category:** flash\
**Created:** [May 23, 2007, 5:52am UTC](https://forum.kirupa.com/t/css-styling-from-as-not-external-file/226692 "2007-05-23T05:52:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![will\_s](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@will\_s](https://forum.kirupa.com/u/will_s)\
**Post date:** [May 23, 2007, 5:52am UTC](https://forum.kirupa.com/t/css-styling-from-as-not-external-file/226692/1 "2007-05-23T05:52:21Z")

</div>

I’m trying to apply some simple CSS coding to an html’d dynamic text box, from _inside_ Flash, with AS, rather than from an external .css doc.

This code below should work, but doesn’t. (I tried adding a period in front of customClass–nuthin’; I also tried taking out the fontFamily altogether, as I’m on a Mac and I’ve heard bad things.)

Any ideas? TIA.

/\*  
var styles = new TextField.StyleSheet();  
styles.setStyle(“p”, {textDecoration:“none”, color:"#000000"});  
styles.setStyle(“customClass”, {fontFamily:"\_serif",fontWeight:‘bold’, color:"#FF0000", fontSize:‘24px’});  
html\_fld.html = true;  
html\_fld.styleSheet = this.styles;  
html\_fld.htmlText = “\<p class=‘customClass’\>Should be red\</p\>\<p\>Should be black and \<span class=‘customClass’\>red again\</a\>\</span\>\</p\>”;  
\*/
