# Synchronous function calls?

**URL:** <https://forum.kirupa.com/t/synchronous-function-calls/171449>\
**Category:** flash\
**Created:** [December 5, 2005, 4:07pm UTC](https://forum.kirupa.com/t/synchronous-function-calls/171449 "2005-12-05T16:07:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RysChwith](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@RysChwith](https://forum.kirupa.com/u/RysChwith)\
**Post date:** [December 5, 2005, 4:07pm UTC](https://forum.kirupa.com/t/synchronous-function-calls/171449/1 "2005-12-05T16:07:54Z")

</div>

Not technically possible, I know. However, the situation I’m in is this:

I have nested for loops that create a 2-dimensional array of objects, like so:

```auto
for( i = 0; i < order.length; i++ ) {
	for( j = 0; j < order[0].length; j++ ) {
		tiles[i][j] = new Tile( order[i][j], findLinkageName( order[i][j] ), j * c_tile_width, i * c_tile_height );
	}
}

```

I need to assign each of the objects an onRelease handler, so I stuck this line in right after the constructor’s called:

```auto
tiles[i][j].mc.onRelease = selectTile;

```

(Obviously, selectTile is defined earlier and mc is a property of the Tile class). The problem, as you may have guessed, is that the onRelease line fires before the constructor’s completed, so there’s no mc property to which a handler can be attached (mc is the MovieClip associated with the instance).

So my question is this: what’s the best way to delay that line until the constructor’s completed? I’d like to avoid having to create events and handlers just to add a handler; seems a bit like sending a tank after a gopher. Any thoughts?

The relevent files are attached. Let me know if I should clarify anything. Thanks.

Rys
