# Quick question about a function (Please Help)

**URL:** https://forum.kirupa.com/t/quick-question-about-a-function-please-help/70896
**Category:** flash
**Created:** [November 18, 2004, 5:53pm UTC](https://forum.kirupa.com/t/quick-question-about-a-function-please-help/70896 "2004-11-18T17:53:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![markP](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@markP](https://forum.kirupa.com/u/markP)
#### Post date: [November 18, 2004, 5:53pm UTC](https://forum.kirupa.com/t/quick-question-about-a-function-please-help/70896/1 "2004-11-18T17:53:37Z")

</div>

The first code is the function that moves and sizes a clip, and the second code is attached to the button. Why does this only work on one clip (always the last one one) and not both of them? I’ll eventually need this to work on many clips at the same time, but I just don’t understand why it’s not working. Can anyone tell me what needs to be done?

Thanks

```auto

// move movie clips
function moveMovieClips(theMovie) {
	baseX = theMovie._x;
	baseY = theMovie._y;
	moveRate = 1;
	distance = 10;
	currentState = -1;
	scaleRate = 2;
	//
	onEnterFrame = function () {
		if (currentState == 1) {
			theMovie._x += moveRate;
			theMovie._xscale -= scaleRate;
			theMovie._yscale -= scaleRate;
			if (theMovie._x >= baseX + distance) {
				currentState = 2;
				theMovie._x = baseX + distance;
			}
		}
		else if (currentState == 3) {
			theMovie._x -= moveRate;
			theMovie._xscale += scaleRate;
			theMovie._yscale += scaleRate;
			if (theMovie._x <= baseX ) {
				currentState = -1;
				theMovie._x = baseX;
				theMovie._xscale = 100;
				theMovie._yscale = 100;
			}
		}
	};
}
//

```

```auto

on (rollOver) {
	moveMovieClips(clip1_mc);
	moveMovieClips(clip2_mc);
	currentState = 1;
}
on (rollOut) {
	moveMovieClipsBack(clip1_mc);
	moveMovieClipsBack(clip2_mc);
	currentState = 3;
}

```
