# Problem with loading data from xternal txt file

**URL:** <https://forum.kirupa.com/t/problem-with-loading-data-from-xternal-txt-file/203203>\
**Category:** flash\
**Created:** [October 9, 2006, 2:02am UTC](https://forum.kirupa.com/t/problem-with-loading-data-from-xternal-txt-file/203203 "2006-10-09T02:02:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dima71](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@Dima71](https://forum.kirupa.com/u/Dima71)\
**Post date:** [October 9, 2006, 2:02am UTC](https://forum.kirupa.com/t/problem-with-loading-data-from-xternal-txt-file/203203/1 "2006-10-09T02:02:14Z")

</div>

[LEFT][FONT=Fixedsys][SIZE=3]Hi[/SIZE][/FONT][/LEFT]  
[FONT=Fixedsys][SIZE=3]This is the script that I use to load data from 2 txt files to a dynamic text:[/SIZE][/FONT]

> 

[LEFT][FONT=Times New Roman][SIZE=3]myData = new LoadVars ()[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myData.onLoad = function () {[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myText.html = “true”[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myText.htmlText = this.var1[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]btn1.onRelease = function () {[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myData.load(“file1.txt”)[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]btn2.onRelease = function () {[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myData.load(“file2.txt”)[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT][/LEFT]

[FONT=Fixedsys][SIZE=3]How to make btn2 load var2 from the txt file1, I know that I can make it if I attached a script on each button, but this is not what I want to do . [/SIZE][/FONT]  
[FONT=Fixedsys][SIZE=3]can I create a function that call the specific peace of data relating to the btn name from one txt file ?[/SIZE][/FONT]  
[FONT=Fixedsys][SIZE=3]so btn1 call var1 from txtfile1, btn2 call var2 from the same txt file1 and so on …? [/SIZE][/FONT]  
[FONT=Fixedsys][SIZE=3]i tried to make like this :[/SIZE][/FONT]  
[FONT=Fixedsys][SIZE=3]

> 

[FONT=Times New Roman][SIZE=3]btn2.onRelease = function () {[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myData.load(“file1.txt”)[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]myText.htmlText = this.var2[/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]

but it didn’t work .  
i hope that you can help me .  
[/SIZE][/FONT]  
[FONT=Fixedsys][SIZE=3]Thank you for your help in advance.[/SIZE][/FONT]
