Using mx.transitions.easing

Greetings, Flash developers!

Using MX2004 Professional, I’m developing a movie that does a couple of things:

  1. Loads three movies in dynamically created MCs (mcTop, mcCenter, mcBottom).
  2. Dynamically replaces the movie in the mcCenter MC.
  3. Resizes the mcCenterMC using easing while resetting the position of the mcBottom MC, also through easing.

Here’s the rub: it doesn’t always work. Sometimes it works exactly as it’s supposed to; other times, it will ease and remove the existing clip, but won’t load the new clip. I would appreciate any suggestions or pointers from more experienced (or less experienced) developers. The code to execute the easing is posted below; the remainder of the movie’s code is generic movieclip loading code and works as expected. Thanks in advance to those who take a few moments to help me out!

dynMC = function (filename) {
	currentHeight = _level0.mcCenter._height;
	trace("currentHeight "+currentHeight);
	outTime = 1.5;
	outH0 = currentHeight;
	outH1 = 0;
	outEase = mx.transitions.easing.Strong.easeIn;
	this.outTweenY = new mx.transitions.Tween(_level0.mcCenter, "_height", outEase, outH0, outH1, outTime, true);
	this.outMoveBottom = new mx.transitions.Tween(_level0.mcBottom, "_y", outEase, 90.5+currentHeight, 90.5, outTime, true);
	outTweenY.onMotionFinished = function() {
		_level0.mcCenter.unloadMovieClip();
		_level0.createEmptyMovieClip("mcCenter", 3);
		_level0.mcCenter._x = 0;
		_level0.mcCenter._y = 95;
		_level0.mcCenter._alpha = 0;
		_level0.mcCenter.loadMovie(filename);
		trace(filename);
		_level0.onEnterFrame = function() {
			var bytesLoaded = _level0.mcCenter.getBytesLoaded();
			var bytesTotal = _level0.mcCenter.getBytesTotal();
			var percentage = int(bytesLoaded*100/bytesTotal);
			trace(percentage);
			if (bytesLoaded == bytesTotal) {
				if (_level0.mcCenter._width != 0 and _level0.mcCenter._height != 0) {
					trace(_level0.mcCenter._height);
					trace(_level0.mcCenter._width);
					centerBounds = _level0.mcCenter.getBounds(_level0);
					getxMin = centerBounds.xMin;
					getxMax = centerBounds.xMax;
					getyMin = centerBounds.yMin;
					getyMax = centerBounds.yMax;
					newY = centerBounds.yMax;
					newHeight = _level0.mcCenter._height;
					trace("newY "+newY);
					trace("newHeight "+newHeight);
					_level0.mcCenter._alpha = 100;
					inTime = 1.5;
					inH0 = 0;
					inH1 = newHeight;
					inEase = mx.transitions.easing.Strong.easeOut;
					this.inTweenY = new mx.transitions.Tween(_level0.mcCenter, "_height", inEase, inH0, inH1, inTime, true);
					this.inMoveBottom = new mx.transitions.Tween(_level0.mcBottom, "_y", inEase, 90.5, 90.5+newHeight, inTime, true);
					inTweenY.onMotionFinished = function() {
						tweenComplete = "true";
						trace(tweenComplete);
					};
				}
			}
			delete _level0.onEnterFrame;
		};
	};
};