# Listening on the timeline for event in a class

**URL:** <https://forum.kirupa.com/t/listening-on-the-timeline-for-event-in-a-class/305077>\
**Category:** Uncategorized\
**Created:** [February 18, 2010, 10:26pm UTC](https://forum.kirupa.com/t/listening-on-the-timeline-for-event-in-a-class/305077 "2010-02-18T22:26:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxelcat](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/maxelcat/32/2854_2.png) [@maxelcat](https://forum.kirupa.com/u/maxelcat)\
**Post date:** [February 18, 2010, 10:26pm UTC](https://forum.kirupa.com/t/listening-on-the-timeline-for-event-in-a-class/305077/1 "2010-02-18T22:26:45Z")

</div>

Hi  
I have a class in which a mc is used as a button.  
I want to use this button to remove from the stage its parent instance.  
Here is a small part of the class called LightBox

```auto

public var _lbClose:BtnSSClose;
:
:
function createCloseBtn():void{
    _lbClose = new BtnSSClose;
    _lbClose.name="lbClose";
    _lbClose.x=875; _lbClose.y=24;
    this.addChild(_lbClose);
   }

```

on the main time line I do:

```auto

:
var lightBoxCont:LightBoxContainer = new LightBoxContainer;
var lbx:LightBox = new LightBox;
lbx.name="lightBox";
:

```

Is it possible to set an event listener of some sort onto this button, but have it listened for out on the maintime line?  
That way, when its pressed I can react to it from the main timeline and delete it?  
Or am I going about this the wrong way?  
As ever thanks for your help  
E
