"onLoad" function for loading text file?

//this is the array of texts as variable;
txtFile = new Array("", "text01", "text03");
txtLoaded = new Array();
//function for loading the text at once
for (i=1; i<txtFile.length; i++) {
 loadText = new LoadVars();
 loadText.onLoad = function(success) {
  if (success) {
   txtLoaded* = this.myText;

This code works with the loading text file. But,
My plan was… to load the texts file in an array of variable named [COLOR=Red]“txtLoaded*”[/COLOR] and then call them in some dynamic textbox when I click the button respectively. But I am not able to call the variable [COLOR=Red]“txtLoaded*”[/COLOR] or whatsoever at all… I simply couldnot understand what is wrong with this code?
Is it variable scope problem? I could pass on to a function but that will read only the last iteration of for loop…thus giving me only the last text information stored in the [COLOR=Red]“txtLoaded*”[/COLOR] Please suggest some thing… I shall be so happy… I have spent many hours banging my head alone… please suggest…

Hey rabi, I had the exact same problem a few days ago.
Thx to some great coders on this forum, I got it fixed in no time. The problem in your code above is that the i counter gets increase as the loop continues. By the time you click a button, the counter is already above your array length.

Thank you verymuch for you reply. But still I couldnot get the array called txtLoaded* out of that function [COLOR=Red]loadText.onLoad = function(){[/COLOR]

That means I couldn’t read [COLOR=Red]trace(txtLoaded*); [/COLOR] when I keep it out of the function [COLOR=Red]loadText.onLoad(); [/COLOR] its kind a difficult… I am not able to think of a way to call it out…

anyway I hope you got my point… :puzzled: