# Dynamically created mc + addressing / event

**URL:** <https://forum.kirupa.com/t/dynamically-created-mc-addressing-event/66723>\
**Category:** flash\
**Created:** [October 8, 2004, 8:56am UTC](https://forum.kirupa.com/t/dynamically-created-mc-addressing-event/66723 "2004-10-08T08:56:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bustaa](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@bustaa](https://forum.kirupa.com/u/bustaa)\
**Post date:** [October 8, 2004, 8:56am UTC](https://forum.kirupa.com/t/dynamically-created-mc-addressing-event/66723/1 "2004-10-08T08:56:36Z")

</div>

Hi guys,

does anyone have a tip on how to “bind” events to dynamically created movieclips ?

```auto

public function createClip():Void {
 
var _images:ImageElement;
var x:Number = 0;
var y:Number = 0;
var _cc:Number = 0;
for (var j:Number = 0; j < _objectArray.length; j++) {
	_images = _objectArray[j];
 
	if (_images.get_image_page() == _cpage) {
	 rootMC.createEmptyMovieClip("images_"+_cc,_cc);
 
 
	 loadMovie(thumb_path + "/" + _images.get_image_thumb(),["images_"+_cc]);
	 setProperty("images_"+_cc,_x,x);
	 setProperty("images_"+_cc,_y,y);
 
 
	 ["images_"+_cc].onPress = function() {
	 trace("CLICKED!");
	 }
 
	 _cc++;
	}
}
}

```

```auto

["images_"+_cc].onPress = function() {
trace ("Blah");
}

```

gives me the following error :

```auto

Unexpected '.' encountered
		 ["images_"+_cc].onPress = function() {

```

does anyone know how to bind (correct addressing syntax) the onPress function to the dynamically created movieclips ? :h:

thx,

bustaa
