# Loading external text-file, works, but still get an error message, why?

**URL:** <https://forum.kirupa.com/t/loading-external-text-file-works-but-still-get-an-error-message-why/192124>\
**Category:** Uncategorized\
**Created:** [June 26, 2006, 11:25am UTC](https://forum.kirupa.com/t/loading-external-text-file-works-but-still-get-an-error-message-why/192124 "2006-06-26T11:25:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendersson](https://avatars.discourse-cdn.com/v4/letter/h/97f17d/32.png) [@hendersson](https://forum.kirupa.com/u/hendersson)\
**Post date:** [June 26, 2006, 11:25am UTC](https://forum.kirupa.com/t/loading-external-text-file-works-but-still-get-an-error-message-why/192124/1 "2006-06-26T11:25:25Z")

</div>

## so, i made a layer called text, with a dynamic textfield and called the instance “newsText”. and then wrote the following ascript on a new layer;

myText = new LoadVars();  
myText.onLoad = function();

MyText {  
newsText.text = this.myVariable;  
}

## myText.load(“newstext.txt”);

i manage to load the text, but i got the following mesage, and i don´t understand why it complains about “Ext\_text” and “test.txt” since I changed it to “myText” and “newstext.txt” :-/

**Error** Symbol=newstext bar 1, layer=newsbar, frame=1:Line 1: Statement must appear within on/onClipEvent handler  
Ext\_text = new LoadVars();

**Error** Symbol=newstext bar 1, layer=newsbar, frame=1:Line 2: Statement must appear within on/onClipEvent handler  
Ext\_text.onLoad = addText;

**Error** Symbol=newstext bar 1, layer=newsbar, frame=1:Line 3: Statement must appear within on/onClipEvent handler  
Ext\_text.load(“test.txt”);

**Error** Symbol=newstext bar 1, layer=newsbar, frame=1:Line 4: Statement must appear within on/onClipEvent handler  
function addText() {
