Help with loadVariables, please

hi,

I am trying to load variables from a text file and having a problem.

i am using this code,


// set variables
var level:Number = 1;
var stage:Number = 1;
var score:Number = 0;
var finalScore:Number = 0;
var nextWord:String = "";

//Load word list
_root.createEmptyMovieClip("wordList", this.getNextHighestDepth());
wordList.loadVariables("/wordTextFiles/L"+level+"S"+stage+"words.txt");
function checkParamsLoaded() {
    if (wordList.done == undefined) {
    trace("not yet.");
    } else {
        for (g in wordList){
            trace (g);
        }
    clearInterval(param_interval);
    }
}

var param_interval:Number = setInterval(checkParamsLoaded, 100);

// display all variables in trace statements for de-bugging
trace ("level - "+level);
trace ("stage - "+stage);
trace ("score - "+score);
trace ("finalScore - "+finalScore);
trace ("next word - "+nextWord);
trace ("total words - "+wordList.totalWords);

when i run this, i get the following output -


level - 1
stage - 1
score - 0
finalScore - 0
next word - 
total words - undefined
done
totalWords
word10
word9
word8
word7
word6
word5
word4
word3
word2
word1

the text file is formatted like this -

word1=bell.mp3&word2=dish.mp3&word3=drum.mp3
&word4=kick.mp3&word5=luck.mp3&word6=plum.mp3
&word7=shed.mp3&word8=ship.mp3&word9=sock.mp3
&word10=tent.mp3&totalWords=10&done="done"

this output confirms that the variables have loaded, but the final trace statement in the script returns “undefined”, if this statement is moved into the function checkParamsLoaded() block, it returns the correct value

I am sure this is something simple, but have no idea what, can anyone help