# Dynamically loading text into an externally loaded movie

**URL:** https://forum.kirupa.com/t/dynamically-loading-text-into-an-externally-loaded-movie/75897
**Category:** flash
**Created:** [January 13, 2005, 12:14am UTC](https://forum.kirupa.com/t/dynamically-loading-text-into-an-externally-loaded-movie/75897 "2005-01-13T00:14:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![juicestain](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@juicestain](https://forum.kirupa.com/u/juicestain)
#### Post date: [January 13, 2005, 12:14am UTC](https://forum.kirupa.com/t/dynamically-loading-text-into-an-externally-loaded-movie/75897/1 "2005-01-13T00:14:46Z")

</div>

I’m trying to apply CSS to text that is loaded from an external text file. Now, it works fine when I play it in the movie file “current.swf”. Here is the code as it is-

```auto
var format = new TextField.StyleSheet();
var path = "jbcss.css";
format.load(path);
format.onLoad = function(success) {
	if (success) {
		output.styleSheet = format;
		myLoadVar = new LoadVars ();
 		myLoadVar.load("news.txt"); 
		myLoadVar.onLoad = function (success){ 
			if (success == true) { 
				output.variable = "news"; 
				output.htmlText=myLoadVar.news;
			}
		}
	} else {
		output.text = "Error loading CSS file!";
	}
};

```

Everything works great until I load “current.swf” into an empty movie clip called “contents” in my main movie timeline. When I play the main movie, I get “Error loading CSS file!”.

I’ve tried (what I feel has been) every targetting possibility to get this to work, with much frustration and no results. Any suggestions???
