# A problem with functions

**URL:** <https://forum.kirupa.com/t/a-problem-with-functions/11328>\
**Category:** flash\
**Created:** [January 15, 2003, 5:40pm UTC](https://forum.kirupa.com/t/a-problem-with-functions/11328 "2003-01-15T17:40:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theta](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Theta](https://forum.kirupa.com/u/Theta)\
**Post date:** [January 15, 2003, 5:40pm UTC](https://forum.kirupa.com/t/a-problem-with-functions/11328/1 "2003-01-15T17:40:56Z")

</div>

Hi all,

I’m having a problem with functions that I was hoping to get a little help with. This is probably pretty basic, but I’m new to AS, and I’m having no luck with it. What I have is two movie clips and a button. I want the movie clips to ease to a certain x position when the button is released. To do this, I’m trying to use the code below on both movie clips:

onClipEvent(load){  
\_x=0;  
speed=10;  
}  
onClipEvent(enterFrame){  
\_x+=(endx-\_x)/speed;  
\_root.button.onRelease = function() {  
endx=100;  
}  
}

This code works great when it’s just on one movie clip. When I put it on two, though, only one moves. Why is that and how can I fix it? I know that if I make the “onRelease” an “onPress” in one of the MC’s, they both move- one on pressing the button and the other on releasing it. That makes sense. But why can’t I make both of them move on releasing it? I don’t get it. Any explanation you could give would be appreciated. Thanx.

Theta

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 7:36pm UTC](https://forum.kirupa.com/t/a-problem-with-functions/11328/2 "2003-01-15T19:36:28Z")

</div>

_bump_

Still haven’t figured this out. Can anyone help?

Theta
