thanks Blanius. But someone else assisted me. This is the code I used:

Code:
var R;
  //
  res=new LoadVars();
  res.load("welcome.txt");

  res.onData=function(info){
    if (info==undefined){
      R="Loading failed";
    }else{
       R=info;
    }
    txt1.text=R;
  }