# Actionscript Problem

**URL:** <https://forum.kirupa.com/t/actionscript-problem/150865>\
**Category:** flash\
**Created:** [June 11, 2005, 3:18am UTC](https://forum.kirupa.com/t/actionscript-problem/150865 "2005-06-11T03:18:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmftballa](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@gmftballa](https://forum.kirupa.com/u/gmftballa)\
**Post date:** [June 11, 2005, 3:18am UTC](https://forum.kirupa.com/t/actionscript-problem/150865/1 "2005-06-11T03:18:05Z")

</div>

Hi, i am having a problem with this script:

```auto
onClipEvent(load) {
	run = 3;
}
onClipEvent(enterFrame) {
	//check to see where the running back is, and go to him
	if (_root.wb._y > this._y) {
		this._y+=run;
	}
	if (_root.wb._y < this._y) {
		this._y-=run;
	}
	if (_root.wb._x < this._x) {
		this._x-=run;
	}
	if (_root.wb._x > this._x) {
		this._x+=run;
	}
MCArray = new Array("l1","l2","l3","l4","l5","l6","l7");
//type in all the movieclips you want it to detect
for (x=0; x<MCArray.length; ++x) {
if (this.hitTest(_root[MCArray[x]])) {
	run = 0
}else{
	run = 3
}
}
}

```

The thing that isnt working is that when i add the }else{ towards the bottom, the speed [run] doesnt change when the movie clip hitTest’s an array.  
But when the else function isnt there, the if statement works fine.  
If you dont get what im saying please say so and i’ll refrase it in a different way.  
Thank You in advance. 🙂
