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.
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.