# External AS files

**URL:** <https://forum.kirupa.com/t/external-as-files/216347>\
**Category:** Uncategorized\
**Created:** [February 15, 2007, 6:24pm UTC](https://forum.kirupa.com/t/external-as-files/216347 "2007-02-15T18:24:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie\_geek](https://avatars.discourse-cdn.com/v4/letter/n/d9b06d/32.png) [@newbie\_geek](https://forum.kirupa.com/u/newbie_geek)\
**Post date:** [February 15, 2007, 6:24pm UTC](https://forum.kirupa.com/t/external-as-files/216347/1 "2007-02-15T18:24:36Z")

</div>

I have a body of AS that when applied to a movie clip makes it elastically follow the mouse around the screen, very nice. it looks like this:

```auto
onClipEvent (load) {
	var Mx = 0;
	var Dx = 0;
	var My = 0;
	var Dy = 0;
	//inertia has to be less then 1 and more than 0
	looseness = 0.5;
	speed = 0.3;
}
onClipEvent (enterFrame) {
	Dx = Math.round(-this._x+_root._xmouse);
	Dy = Math.round(-this._y+_root._ymouse);
	Mx = Mx*looseness + Dx*speed;
	My = My*looseness + Dy*speed;
	this._x += Mx; 
	this._y += My; 
	//trace(Mx);
}

```

What i want to do is turn it into a section of code that can live in an external AS file that can then be called from any point in the massive project that this is going to be used for.

What should the external AS file look like? And what should the code on the MC that is calling it look like?

I have been bumbling with it for a while, and there seems to be a crucial bit of syntax that i am not getting.

Much Appreciated.
