Problem returning values from a function

I need to load data from a database, so I created the following function and placed it in frame 2 on the main timeline.

getQuestionSet = function (category:String, subject:String, level:Number, count:Number):Array {
	var questionSet:Array = new Array();
	var writeV:LoadVars = new LoadVars();
	var readV:LoadVars = new LoadVars();
	// stop browser from returning cached results
	writeV.cacheKiller = new Date().getTime();
	writeV.category = category;
	writeV.subject = subject;
	writeV.level = level;
	writeV.count = count;
	writeV.sendAndLoad("getQuestionSet.aspx", readV, "GET");
	readV.onLoad = function(success) {
		if (success) {
			questionSet[0] = readV.pk1;
			questionSet[1] = readV.pk2;
			questionSet[2] = readV.pk3;
			questionSet[3] = readV.pk4;
			questionSet[4] = readV.pk5;
			questionSet[5] = readV.pk6;
			questionSet[6] = readV.pk7;
			questionSet[7] = readV.pk8;
			questionSet[8] = readV.pk9;
			questionSet[9] = readV.pk10;
			_root.questions = questionSet;
	return questionSet;

I also created a variable in the first frame of the main timeline as so.

var questions:Array = new Array();

Whenever I try to call the function, it fails to set the value of the questions array. It always appears empty(questions[0]-questions[10] have the value undefined). But, if I check the values from within the function after I have set them, it works, so I know that it is receiving the values. What am I doing wrong?

questions = getQuestionSet("Art and Music", "Art", 1, 10);

Here is an example of how I have would call the function.
Also, please feel free to give me constructive comments on my actionscripting, I’m still new.