# Class help --- checking values on the stage

**URL:** <https://forum.kirupa.com/t/class-help-checking-values-on-the-stage/325849>\
**Category:** flash\
**Created:** [November 8, 2011, 12:12pm UTC](https://forum.kirupa.com/t/class-help-checking-values-on-the-stage/325849 "2011-11-08T12:12:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [November 8, 2011, 12:12pm UTC](https://forum.kirupa.com/t/class-help-checking-values-on-the-stage/325849/1 "2011-11-08T12:12:13Z")

</div>

Hi I am trying to build a simple class, where my object(s) that get put on the stage continually checks through an EnterFrame Event the y position of an animation on the stage, and if the y pos of this animation is greater than the object doing the checking, then I want to remove it from the stage.  
//-- doc class

```auto
var s:Sqr = new Sqr();
s.y = 200;
addChild(s);
line_mc.addEventListener(Event.ENTER_FRAME,timer):void
{
    e.target.y += 2;
}

```

//-- Sqr class

```auto
import flash.display.Event;    
public class Sqr extends Sprite
    {
        public function Sqr() 
        {
            this.addEventListener(Event.ENTER_FRAME,timer);
        }
        private function timer(e:Event):void
        {
            // how do I reference line_mc ?
                        if(line_mc.y > this.y)
                        {
                              this.removeEventListener();
                              removeChild(this);
                        }
        }
    }

```

thanks yo
