# Attaching a CSS stylesheet to an XML file in Flash

**URL:** <https://forum.kirupa.com/t/attaching-a-css-stylesheet-to-an-xml-file-in-flash/296654>\
**Category:** flash\
**Created:** [September 17, 2009, 7:55pm UTC](https://forum.kirupa.com/t/attaching-a-css-stylesheet-to-an-xml-file-in-flash/296654 "2009-09-17T19:55:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![prone](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@prone](https://forum.kirupa.com/u/prone)\
**Post date:** [September 17, 2009, 7:55pm UTC](https://forum.kirupa.com/t/attaching-a-css-stylesheet-to-an-xml-file-in-flash/296654/1 "2009-09-17T19:55:37Z")

</div>

Hello!

I was wondering if this can be done? I want to format my content that’s in an XML file, being loaded to a dynamic text box using AS3? I’ve been trying to do this and find any information on the this task. When I put everything together the XML file shows up in the dynamic text box without any styles being applied to it. (As if its ignoring it.) Please help.

```auto
var cssLoader:URLLoader = new URLLoader();
var cssRequest:URLRequest = new URLRequest("content.css");
var sheet:StyleSheet = new StyleSheet();
cssLoader.load(cssRequest);
cssLoader.addEventListener(Event.COMPLETE, cssLoadComplete);

function cssLoadComplete(event:Event):void
{
    //trace(cssLoader.data);
       sheet.parseCSS(cssLoader.data);
   // Now assign the StyleSheet to a text field for example
    textBox.styleSheet = sheet;
  //textBox.text = styles.texttitle;
  
 
  // Now you would load any external text or html into
  // the text field
}

```

[COLOR=darkorange]CSS:[/COLOR]

@charset “utf-8”;  
/\* CSS Document \*/

content {font-size: 30px;color:#3300CC;}

[COLOR=darkorange]XML:[/COLOR]

\<?xml version=“1.0” encoding=“ISO-8859-1”?\>  
\<?xml-stylesheet type=“text/css” href=“content.css”?\>

\<TEXT\>  
\<content\>  
Hello World!  
\</content\>  
\</TEXT\>

In the Fla… the dynamic text box is labeled: textBox

I’m not sure why this doesn’t work.
