# AS3 mysteries

**URL:** <https://forum.kirupa.com/t/as3-mysteries/332439>\
**Category:** flash\
**Created:** [June 8, 2014, 5:42am UTC](https://forum.kirupa.com/t/as3-mysteries/332439 "2014-06-08T05:42:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newtome](https://avatars.discourse-cdn.com/v4/letter/n/c4cdca/32.png) [@newtome](https://forum.kirupa.com/u/newtome)\
**Post date:** [June 8, 2014, 5:42am UTC](https://forum.kirupa.com/t/as3-mysteries/332439/1 "2014-06-08T05:42:49Z")

</div>

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?
