# Wait until external data loads

**URL:** https://forum.kirupa.com/t/wait-until-external-data-loads/122114
**Category:** Uncategorized
**Created:** [September 10, 2004, 10:58am UTC](https://forum.kirupa.com/t/wait-until-external-data-loads/122114 "2004-09-10T10:58:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fightalone](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@fightalone](https://forum.kirupa.com/u/fightalone)
#### Post date: [September 10, 2004, 10:58am UTC](https://forum.kirupa.com/t/wait-until-external-data-loads/122114/1 "2004-09-10T10:58:44Z")

</div>

ok… this my prob:

i’ve got a function which loads data from an external .txt (an interger value)… this basically works fine… BUT… the problem is that the script doesnt wait for

```
 _global.iPicNumber = 0;
 loadText = new LoadVars();
 loadText.load(_global.sPicPath + 'PicNr.txt');
**loadText.onLoad = function()**
 {
         _global.iPicNumber = this.iNumber;
         trace("COUNT 01" + _global.iPicNumber);
 };
         trace("COUNT 02" + _global.iPicNumber);

```

to sucess… the whole script is done before \_global.iPicNumber is set;

the output: COUNT 02 = 0;  
COUNT 01= 18; //this is what it should be

the script simply doesnt wait until loadText.onLoad = function() is execurted… and this is a problem…

i need to tell the script to wait until \_global.iPicNumber is set…

any ideas how to solve this problem…??

thx in advance

yours sincerly
