I’m trying to remove a linked MC once it reaches a certain point on the stage, but it seems to remove all the MC’s. How do I single out just the specific one that is at that stage position?
Here is my code:
package
{
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import caurina.transitions.*;
public class DocumentClass extends MovieClip
{
private var timer:Timer = new Timer(100);
public function DocumentClass():void
{
timer.addEventListener(TimerEvent.TIMER, makeStar);
timer.start();
}
private function makeStar(e:TimerEvent):void
{
var star:Star = new Star();
star.scaleX = star.scaleY = Math.random();
star.x = Math.random() * this.stage.stageWidth
star.y = 400;
Tweener.addTween(star, {y:-20,time:5, transition:"easeoutExpo"});
this.addChild(star);
if(star.y >= 10)
{
trace("this is working");
/*this.removeChild(star);*/
}
}
}
}