This content has been marked as final. Show 3 replies
Well it looks like you have return myWordList outside of the onLoad function. So it is trying to return the array before it has loaded.
Also you shouldn't use boolean value "true" for the name of an argument in a function, if (true) will always be true because that is what it is! So change that to something like success or figtree, but not another reserved word!
It would also seem that lingoWord is a string, not an array. Unless the elements of myWordList are arrays then lingoWord isn't going to be an array.
If i'm interpreting your code correctly, it looks as though you're doing things in the wrong order - first you pick a word at random from a list, and then you fill the list. This would work better if you fill the list and then pick a word at random.
remove the return value in your loadWords function because you haven't populated your list until the onload handler is called. move the line "var myWord:Array = pickWord(myWordList);" into your myWordLoader.onLoad handler - (after "trace(myWordList);") and it should pick a word okay at random from your text file. fingers crossed!
Thank you both for your help. I applied your suggestions, and now my traces are coming back with results I expect!
Now to keep working on this stuff.... it's an assignment for a class due tomorrow, and I have a long way to go.... <sigh>