External txt with external css

I recently followed the steps in tutorials [color=#003366]**Using **CSS Styles in Flash MX 2004 [color=#000000]and [/color]Applying[/color][color=#003366] CSS to Externally Loaded Text. Although I attemped a couple of times I could not get anything to work… the text or the css. I don’t even generate the text that says I cannot load the CSS file. Any suggestions would be appreciated.

Thanks,
-Webfoley (the code I used is below)[/color]

  1. I created a dynamic textbox with render HTML on and instance name ‘textbox’.
  2. The external text file is located in folder ‘txt’ and is called mytext.txt. It begins with thetext=
  3. For my trial I used the Kirupa CSS called flash.css and referenced the <p class=‘four’> in the mytext.txt content.
  4. I use a movieclip with the top layer action on the first frame and the textbox used on the layer below. The action reads:

var format = new TextField.StyleSheet();
var path = “http://www.kirupa.com/developer/mx2004/code/flash.css”;
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
textbox.styleSheet = format;
myLoadVar = new LoadVars ();
myLoadVar.load(“txt/mytext.txt”)
myLoadVar.onLoad = function (success){
if (success == true) {
textbox.variable = “thetext”
textbox.htmlText=myLoadVar.thetext;
}
}
} else {
output.text = “Error loading CSS file!”;
}
};