Waiting for animation to complete - How?

This should be really, really simple, but I’m surprised at how confused I am. Here’s the deal:

  • I’m using a custom class to lay out a background consisting of square tiles picked at random. These are provided to the class as an array of library symbols, and they are placed on stage with the attachMovie method.

  • These tiles are different animations that all end up in a solid colored square. When all the tiles have finished animating, the result will be a large rectangular shape that serves as a unified background for content like text and graphics, so I’t simply a sort of fancy build animation for the background.

  • Naturally, I don’t want to be displaying content before the animation has finished, so I need to do that based on some kind of event being dispatched. The problem is that these animations are timeline-based and I want my class to know when all background clips have reached their final frame.

The question: How should I do this? Extending MovieClip for each of the animations seems a bit tedious since that would require one class per background tile MovieClip, and I don’t want to be constantly checking the currentFrame of all the clips either.

Any ideas? I’m going mad here…

Here’s the code for the class that places all the tiles on stage. I included only the constructor since that’s pretty much the whole class.

	public function TiledBackground(target:MovieClip,
		var d:Number = target.getNextHighestDepth();		
		this.wrapper = target.createEmptyMovieClip("tiledBg" + d, d);

		var nSymbols = bgSymbols.length;
		var hBlockCounter:Number = 0;
		var rowCounter:Number = 0;

		for (var i:Number = 0; i < nSymbols; i++)
			var mc:MovieClip = this.wrapper.attachMovie(bgSymbols*, "tile" + i, i);
			mc._x = mc._width * hBlockCounter;
			mc._y = mc._height * rowCounter;

			if (hBlockCounter < hBlocks - 1)
				hBlockCounter = 0;

		this.wrapper._x = x;
		this.wrapper._y = y;