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
var s:Sqr = new Sqr();
s.y = 200;
addChild(s);
line_mc.addEventListener(Event.ENTER_FRAME,timer):void
{
e.target.y += 2;
}
//-- Sqr class
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