# For...in event handlers

**URL:** <https://forum.kirupa.com/t/for-in-event-handlers/73496>\
**Category:** Uncategorized\
**Created:** [December 16, 2004, 9:25pm UTC](https://forum.kirupa.com/t/for-in-event-handlers/73496 "2004-12-16T21:25:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newhopekenny](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/newhopekenny/32/317_2.png) [@newhopekenny](https://forum.kirupa.com/u/newhopekenny)\
**Post date:** [December 16, 2004, 9:25pm UTC](https://forum.kirupa.com/t/for-in-event-handlers/73496/1 "2004-12-16T21:25:12Z")

</div>

I’m currently just testing a few items in Flash. While I’m in this early stage, it’d be quite handy for this particular project if there were a way to assign events to every item in a certain MC (or on \_root).

Here’s what I’ve done thus far:

```auto

for (movieClip in _root) {
	movieClip.onRollOver = function() {
		this.gotoAndStop(2);
	};
	movieClip.onRollOut = function() {
		this.gotoAndStop(1);
	};
	movieClip.onPress = function() {
		this.gotoAndStop(3);
	};
	movieClip.onRelease = movieClip.onReleaseOutside=function () {
		this.gotoAndStop(1);
	};
}

```

If I trace I can clearly see the instance names of the MCs (which means it works – sort of), but no matter what I’ve tried I can’t get the events to bind to the on-stage MCs.

Any / all help would be wonderful, though I’m not holding my breath on this even being possible at this point.
