AS3 mysteries

As a “toe in the water” exercise, I’m trying to migrate an AS2 swf to AS3. I’ve been reading lots of helpful texts but there are still some things that I’m having a problem with - here’s one of them.

I created a simple button called exit_btn and dragged it onto the stage calling it exit_btn. I added a listener:

exit_btn.addEventListener(MouseEvent.CLICK, exitSwf);

and a function:

function exitSwf(event:MouseEvent):void
{
trace(“exit button pressed”);
}

When I execute, I get a compiler error:

Type was not found or was not a compile-time constant: exit_btn.

Why?