I can´t access downloaded variables outside the function

I can´t access downloaded variables outside the function.
I have had this question in forum Actionscript.org but I didn´t got a reply that works for me, so I try this forum.
I have worked with this for weeks and would really appreciate if I got an answer that will work this out.

ActionScript:
var loader = new LoadVars();
loader.load("kiruppa.txt");
trace("loader.total1="+loader.total);
loader.onLoad = function(successful){
		if (successful){
				trace("loader.total2="+loader.total);
		}else{
				trace("Error in loading myVariables");
		}
}
trace("loader.total3="+loader.total);
trace("total="+total);

the output:

 loader.total1=
loader.total3=
total=
loader.total2=8

trace(“loader.total2=”+loader.total); gave the output loader.total2=8
That shows that the variable total is loaded successful.
Then outside the function
trace(“loader.total3=”+loader.total); gave the output loader.total3=
trace(“total=”+total); gave the output total=
the variable was loaded but I can´t access it outside the function. I got the advise to wait until it´s loaded, butI don´t understand how to do.