Function and global variables

[AS]
fileNamesLoadVars = new LoadVars();
fileNamesLoadVars.load(“getFilesNames.txt”);
fileNamesLoadVars.onLoad = function(){
_global.gFileNamesArray = this.fileNames.split("|");
trace(_global.gFileNamesArray.length); //which output successfully in output window as 7
}

for(i=0; i< _global.gFileNamesArray.length; i++){
//do something here

}
[/AS]

ok… i’ve got problem with the actionscipt above… this AS is inside a movieclip at the first frame. i’ve declared _global.gFileNamesArray = new Array(); in the main timeline(_root), but the problem is my ‘for loop’ which it couldn’t get the global variable…

when i do a trace(_global.gFileNamesArray.length) outside the loadvars.load function it gives me 0…

any suggestions y…? how do i use the loadvars.load function to manipulate a global variable…?

i’m rather new to actionscript btw…