# Killing AS easing once target is met

**URL:** <https://forum.kirupa.com/t/killing-as-easing-once-target-is-met/185737>\
**Category:** Uncategorized\
**Created:** [April 16, 2006, 12:21am UTC](https://forum.kirupa.com/t/killing-as-easing-once-target-is-met/185737 "2006-04-16T00:21:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![East\_High](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@East\_High](https://forum.kirupa.com/u/East_High)\
**Post date:** [April 16, 2006, 12:21am UTC](https://forum.kirupa.com/t/killing-as-easing-once-target-is-met/185737/1 "2006-04-16T00:21:59Z")

</div>

Okay, so as you can see below, the target for this mc is the edge of the screen/stage. I also have some AS on the time line that keeps this mc aligned with the edge of the stage if it’s stretched. The problem is the two codes conflict with one another to make the whole thing not work correctly.

I’m hoping someone here can help me put a ‘kill’ in the easing script so once the mc has hit its ‘targetX’ the enterframe function will stop, letting the AS on the timeline take over.

moveclip AS:

```auto
onClipEvent (load) {
	targetX = Stage.width-this._width;
}
onClipEvent (enterFrame) {
	this._x += (targetX-this._x)/10;
}

```

timeline AS:

```auto
stageListener = new Object();
stageListener.onResize = function() {
	positionBranches();
};
Stage.addListener(stageListener);
positionBranches = function () {
	rightBranch_mc._x = Stage.width-rightBranch_mc._width;
};

```

thanks!!

---

<div class="post-metadata">

**Author:** ![East\_High](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@East\_High](https://forum.kirupa.com/u/East_High)\
**Post date:** [April 17, 2006, 7:04pm UTC](https://forum.kirupa.com/t/killing-as-easing-once-target-is-met/185737/2 "2006-04-17T19:04:14Z")

</div>

_bump_

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [April 17, 2006, 7:39pm UTC](https://forum.kirupa.com/t/killing-as-easing-once-target-is-met/185737/3 "2006-04-17T19:39:13Z")

</div>

Remove the AS on the mc and change the AS on the timeline like this

```auto
stageListener = new Object();
stageListener.onResize = function() {
	positionBranches();
};
Stage.addListener(stageListener);
positionBranches = function () {
	var tarx = Stage.width-rightBranch_mc._width;
	rightBranch_mc.onEnterFrame = function() {
		this._x += (tarx-this._x)/10;
		if (Math.abs(this._x-tarx)<1) {
			this._x = tarx;
			delete this.onEnterFrame;
		}
	};
};
stageListener.onResize();

```

scotty(-:
