# Passing variable from external .txt file to field name

**URL:** <https://forum.kirupa.com/t/passing-variable-from-external-txt-file-to-field-name/249503>\
**Category:** flash\
**Created:** [January 19, 2008, 1:24pm UTC](https://forum.kirupa.com/t/passing-variable-from-external-txt-file-to-field-name/249503 "2008-01-19T13:24:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![slacklad](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@slacklad](https://forum.kirupa.com/u/slacklad)\
**Post date:** [January 19, 2008, 1:24pm UTC](https://forum.kirupa.com/t/passing-variable-from-external-txt-file-to-field-name/249503/1 "2008-01-19T13:24:00Z")

</div>

Hi - probably a hugely embarrassing beginner question, but I can’t seem to find an answer anywhere. I think it’s probably (hopefully?) just a syntax problem, so if anyone could point me in the right direction I’d be really grateful.

I’m loading the content of a dynamic text box from an external .txt file and I’m trying to find a way to change the content from a link in the .txt file (if that makes sense).

The code I’m using to change the dynamic text box at the moment is:

```auto

myData = new LoadVars();
myData.onLoad = function() {
    hometextbox.html = true;
    hometextbox.htmlText = this.newstext;
    hometextbox.scroll = 0;

    if (hometextbox.maxscroll<=hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = false;
        _level0.application.form1.downbutton._visible = false;
    } else if (hometextbox.maxscroll>hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = true;
        _level0.application.form1.downbutton._visible = true;
    }
};
myData.load("Textfile.txt");

```

and it’s working fine, but I’d like to have a link like

```auto

<A HREF="asfunction:MyFunc,contacttext ">Contact</A>

```

inside my .txt file which changes what is loaded into the dynamic text box.

I thought it might be something like:

```auto

function MyFunc(arg){
myData = new LoadVars();
myData.onLoad = function() {
    hometextbox.html = true;
    hometextbox.htmlText = this[arg];
    hometextbox.scroll = 0;

    if (hometextbox.maxscroll<=hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = false;
        _level0.application.form1.downbutton._visible = false;
    } else if (hometextbox.maxscroll>hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = true;
        _level0.application.form1.downbutton._visible = true;
    }
};
myData.load("Textfile.txt");
}

```

but I’ve had no joy. Can anyone tell me what I’m doing wrong?

Cheers!

- f
