# Need Help With External Test and CSS

**URL:** <https://forum.kirupa.com/t/need-help-with-external-test-and-css/297431>\
**Category:** flash\
**Created:** [October 1, 2009, 10:57pm UTC](https://forum.kirupa.com/t/need-help-with-external-test-and-css/297431 "2009-10-01T22:57:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mini\_Master2000](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mini\_Master2000](https://forum.kirupa.com/u/Mini_Master2000)\
**Post date:** [October 1, 2009, 10:57pm UTC](https://forum.kirupa.com/t/need-help-with-external-test-and-css/297431/1 "2009-10-01T22:57:53Z")

</div>

Right now, I successfully loaded a body of text into my movie from an external text file and a css file. However, when I test my movie, the text wouldn’t load at the first click. And I get this error message:

> TypeError: Error #1009: Cannot access a property or method of a null object reference.  
> at about\_fla::MainTimeline/frame1()  
> But then it loads at the second click without any error messages. Does any know why this is happening?

Also, I saw the “Write On Text Effect” tutorial at [http://www.gotoandlearn.com](http://www.gotoandlearn.com/). But it seems like it’s for actionscript 2. Does anyone know how can I convert this into actionscript 3 and apply it to my existing code?

Thank you so much!

```auto
import flash.text.TextField;
import flash.text.StyleSheet;

var textfield:TextField = new TextField();
    textfield.width = 800;
    textfield.height = stage.stageHeight;
    textfield.wordWrap = true;
    textfield.autoSize = TextFieldAutoSize.LEFT;
    textfield.selectable = false;
    addChild(textfield);
    
var wordList:Array = new Array();

var textLoader:URLLoader = new URLLoader();
    textLoader.addEventListener(Event.COMPLETE, textLoaded);

var cssLoader:URLLoader = new URLLoader();
var css:StyleSheet = new StyleSheet();

function cssLoaded(e:Event):void{
    css.parseCSS(e.target.data);
    textfield.styleSheet = css;
    
    for(var i:int = 0; i < wordList.length; i++){
        textfield.htmlText += "<h4>" + wordList* + "</h4>";
    }
}
function textLoaded(e:Event):void{
    wordList = e.target.data.split("
");
    cssLoader.load(new URLRequest("about.css"));    
    cssLoader.addEventListener(Event.COMPLETE, cssLoaded);
}

textLoader.load(new URLRequest("about.txt"));

```
