# Problem with CSS and AS2

**URL:** <https://forum.kirupa.com/t/problem-with-css-and-as2/246130>\
**Category:** flash\
**Created:** [December 7, 2007, 9:59am UTC](https://forum.kirupa.com/t/problem-with-css-and-as2/246130 "2007-12-07T09:59:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unkulunkulu](https://avatars.discourse-cdn.com/v4/letter/u/85f322/32.png) [@unkulunkulu](https://forum.kirupa.com/u/unkulunkulu)\
**Post date:** [December 7, 2007, 9:59am UTC](https://forum.kirupa.com/t/problem-with-css-and-as2/246130/1 "2007-12-07T09:59:10Z")

</div>

If I paste this in to an empty Flash document, it doesn’t work. Can anyone tell me why. The Publish settings are Flash Player 7 and ActionScript 2.

```auto
import TextField.StyleSheet;

var my_styleSheet:StyleSheet = new StyleSheet();

var styleObj:Object = new Object();
styleObj.color = "#cc0000";
styleObj.fontWeight = "bold";
styleObj.fontFamily = "sans-serif";
my_styleSheet.setStyle("headline", styleObj);
delete styleObj;

for (var i in my_styleSheet) {
    trace(i+ ": " + my_styleSheet*)
    
    for (var j in my_styleSheet*) {
        trace(" "+ j + ": " + my_styleSheet*[j]);
        
        for (var k in my_styleSheet*[j]) {
            trace(" "+ k + ": " + my_styleSheet*[j][k]);
        }
    }
}

this.createTextField("news_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
news_txt.wordWrap = true;
news_txt.multiline = true;
news_txt.html = true;

var newsText:String = "<p class='headline'>Description</p> Method; "
    + "starts loading the CSS file into styleSheet. The load operation is asynchronous; "
    + "use the <span class='bold'>TextField.StyleSheet.onLoad</span> "
    + "callback handler to determine when the file has finished loading. "
    + "<span class='important'>The CSS file must reside in exactly the same "
    + "domain as the SWF file that is loading it.</span> For more information about "
    + "restrictions on loading data across domains, see Flash Player security features.";

news_txt.styleSheet = myStyleSheet;
news_txt.htmlText = newsText;

```
