# Can't trigger function twice

**URL:** <https://forum.kirupa.com/t/cant-trigger-function-twice/13391>\
**Category:** Uncategorized\
**Created:** [February 12, 2003, 2:09pm UTC](https://forum.kirupa.com/t/cant-trigger-function-twice/13391 "2003-02-12T14:09:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![j0se](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/j0se/32/44_2.png) [@j0se](https://forum.kirupa.com/u/j0se)\
**Post date:** [February 12, 2003, 2:09pm UTC](https://forum.kirupa.com/t/cant-trigger-function-twice/13391/1 "2003-02-12T14:09:09Z")

</div>

hi guys! :beam: i’ve not been been flashing lately (hence my absence) :trout: until now :rambo:

ok, i have a function that loads a text file into a textbox

i call the function from a series of menu buttons (about us, clients etc…)

both the function and the textbox are on the main time line (the textbox is in an mc instance named “text\_mc”

the function triggers when i click any button - but won’t trigger again after that

button code:  
on(press){  
loadText(“services.txt”);  
}

function code:  
function loadText(fileToLoad){  
loadText = new loadVars();  
loadText.load(fileToLoad);  
loadText.onLoad = function(success) {  
if (success){  
//load the text file [look for a var named “fileText”]  
//into the dynamic textbox [txtBox]  
\_root.text\_mc.txtBox.text = this.fileText;  
} else {  
.  
.  
.

\*\* if i put both bits of code behind each button it works fine (but i obviously don’t want to do that)

ok, many cheers if anybody can help  
😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2003, 2:57pm UTC](https://forum.kirupa.com/t/cant-trigger-function-twice/13391/2 "2003-02-12T14:57:25Z")

</div>

Did you try \_global?

```php
_global.loadText = function(fileToLoad) {
	loadText = new LoadVars();
	loadText.onLoad = function(success) {
		if (success) {
			//load the text file [look for a var named "fileText"] 
			//into the dynamic textbox [txtBox] 
			_root.text_mc.txtBox.text = this.fileText;
		} else {
			trace("Error Loading "+fileToLoad);
		}
	};
	loadText.load(fileToLoad);
};
loadText("textfile.txt");

```
