# Changing the location of some actionscript

**URL:** <https://forum.kirupa.com/t/changing-the-location-of-some-actionscript/170751>\
**Category:** Uncategorized\
**Created:** [November 29, 2005, 9:30am UTC](https://forum.kirupa.com/t/changing-the-location-of-some-actionscript/170751 "2005-11-29T09:30:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![roob](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@roob](https://forum.kirupa.com/u/roob)\
**Post date:** [November 29, 2005, 9:30am UTC](https://forum.kirupa.com/t/changing-the-location-of-some-actionscript/170751/1 "2005-11-29T09:30:54Z")

</div>

Right, in the neverending tale of my problems, I have another one which I can’t seem to solve.

I have this actionscript

[AS]onClipEvent (enterFrame) {

```
currentlocx = this._x;
currentlocy = this._y;
differencex = newX - currentlocx;
differencey = newY- currentlocy;
accelx = differencex/accelFactor;
accely = differencey/accelFactor;
this._x = this._x + accelx;
this._y = this._y + accely;
if (Math.round(this._y) == Math.round(newY) && Math.round(this._x) == Math.round(newX) ) {
    newX = Math.round(Math.random()*640);
    newY = Math.round(Math.random()*480);
    accelFactor = Math.ceil(Math.random()*4) + 2;
}

```

}  
onClipEvent (load) {  
newX = Math.round(Math.random()\*640);  
newY = Math.round(Math.random()\*480);  
accelFactor = Math.ceil(Math.random()\*4) + 2;  
}[/AS]

nestled inside a movieclip instance. Not contained in a frame of the movieclip’s timeline, but the actions for the movieclip (which are displayed when you single click on the movieclip when its in the timeline). I Didn’t mean to make that sound patronising, but just so you know which part I am on about. 😛

Anyway, what I want to do is put the above code into a frame on my ‘Actions’ layer on the main timeline and somehow replace that code (which is in my movieclip) with something far simpler. I.e.

[AS]onClipEvent(enterFrame){  
move();  
}[/AS]

Or something to that effect. My movieclip will be called ‘spore’+i (where ‘i’ is incrementing values starting at 1).

:book:
