# Moving, but not the way I want

**URL:** https://forum.kirupa.com/t/moving-but-not-the-way-i-want/37233
**Category:** Uncategorized
**Created:** [December 7, 2003, 6:19pm UTC](https://forum.kirupa.com/t/moving-but-not-the-way-i-want/37233 "2003-12-07T18:19:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![crapboyjr](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@crapboyjr](https://forum.kirupa.com/u/crapboyjr)
#### Post date: [December 7, 2003, 6:19pm UTC](https://forum.kirupa.com/t/moving-but-not-the-way-i-want/37233/1 "2003-12-07T18:19:02Z")

</div>

I’m trying to learn actionscript…uphill battle. ☹

I have two movie clips.  
When I rollover mc1, I want it to move mc2 to a position 108.7 from mc2’s original position.

I right-clicked mc1, selected Actions and placed the following code on it:

* * *

onClipEvent (load) {  
\_x = 0;  
\_y = 0;  
div = 5;  
}

onClipEvent (enterFrame) {  
\_parent.mc2.\_x += (endX-\_x)/div;  
\_parent.mc2.\_y += (endY-\_y)/div;

\_parent.mc1.onRollover = function() {  
\_parent.mc2.onEnterFrame = function() {  
endX = 108.7;  
endY = 0;

```
};

```

}  
}

* * *

Problem is, when I rollover mc1, it cause mc2 to move right off of the screen. It won’t stop at the position of 108.7.

I’m pretty sure the way I wrote the code is messed up. I took bit’s and pieces from other examples to get this to work. Or not work in this case.

Thanks for any help
