So when you win my game I add a movieclip that will let you enter your name through a text input component. Unfortunately, I'm calling it wrong.

I'm getting an undefined property error because it's out of the youWon function, right? You'd think I'd understand this concept eventually!

Actionscript Code:
function youWon() {
    var congrats = new (getDefinitionByName("congrats") as Class);
    congrats.nameInput.addEventListener(Event.CHANGE, textEntered);

function textEntered(e:Event):void {