# Putting dynamic loaded text into a variable

**URL:** https://forum.kirupa.com/t/putting-dynamic-loaded-text-into-a-variable/83117
**Category:** Uncategorized
**Created:** [March 16, 2005, 7:16am UTC](https://forum.kirupa.com/t/putting-dynamic-loaded-text-into-a-variable/83117 "2005-03-16T07:16:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Blenderben](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blenderben/32/74_2.png) [@Blenderben](https://forum.kirupa.com/u/Blenderben)
#### Post date: [March 16, 2005, 7:16am UTC](https://forum.kirupa.com/t/putting-dynamic-loaded-text-into-a-variable/83117/1 "2005-03-16T07:16:20Z")

</div>

i want to be able to dynamically load some text from a .txt file…  
i use this method

```auto

loadText = new LoadVars();
loadText.load("blog.txt");
loadText.onLoad = function() {
       blog.text = this.blogtext;
};

```

using this method i can load the txt from ‘blog.txt’ into a dynamic text box. but this isn’t what i want…  
the text i put in blog.txt i want to be equal to a varible in flash.

so i tired…

```auto
loadText = new LoadVars();
loadText.load("blog.txt");
loadText.onLoad = function() {
	blog.text = this.blogtext;
	var text = this.blogtext;
};
trace(text);

```

for the output screeen i got “undefined”. can anyone tell me how to fix this so when i run it, the output says exactly what i typed in the “blog.txt”?
