# W8 until URLLoader finishes loading?

**URL:** <https://forum.kirupa.com/t/w8-until-urlloader-finishes-loading/321223>\
**Category:** flash\
**Created:** [April 13, 2011, 5:10pm UTC](https://forum.kirupa.com/t/w8-until-urlloader-finishes-loading/321223 "2011-04-13T17:10:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tove](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tove](https://forum.kirupa.com/u/tove)\
**Post date:** [April 13, 2011, 5:10pm UTC](https://forum.kirupa.com/t/w8-until-urlloader-finishes-loading/321223/1 "2011-04-13T17:10:49Z")

</div>

Hi!

I am trying to load the output of a php-file into some flash variables and then fill some textfields with those variables. But it seems like even though i have a completehandler it tries to fill the textfields before i get all the data. Could someone please take a look at my code and see if there is anything wrong?

```auto
 
function loadQuestion(){
  var request:URLRequest = new URLRequest("the url to my php script");
  request.method = URLRequestMethod.GET;
  var loader:URLLoader = new URLLoader();
  loader.dataFormat = URLLoaderDataFormat.VARIABLES;
  loader.addEventListener(Event.COMPLETE, completeHandler);
  loader.load(request);
 
  function completeHandler(evt:Event) {
    question = evt.target.data.question;
    answer = evt.target.data.answer;
    qfield.text = question; 
    afield.text = answer;
  }
}
loadQuestion();

```

Is it wrong of me to have the completeHandler inside the loadQuestion function? And is it wrong of me to assume that because i put the data in the textfields in the completeHandler it should w8 until its finished loading?

All help much appreciated!
