MX: Gah! I mean... dynamic startDrag & stopDrag?

Good day.

This is another example of “already solved the problem”… but I’m going to paste it anyways, in case you have the same problem.

I have a fla that creates various instances of various MCs (all works fine) but since they are created by AS, they are “above everything else”… this is where my problem *almost *starts:

I want a caption in the application that appears when you move your mouse over those MC instances. That works, too, because I am creating an instance of the original caption on the fly as well, after everything else, so it’s “above the rest” (just like my fla skills might be some day :D).

Okay- now here’s the problem: The application lets you switch between different screens. Each of those screens creates MC instances on the fly- but since the caption already exists, it’s not “instanciated” again, so on the second page, it’s underneith the other dynamic MCs.

Is there a way to check whether an MC copy already exists so I can have a case-dependent handling?

Here is the solution:

// Activate the Caption
function startCap() {
	if (_root.caption) {
		_root.caption.stopDrag();
		_root.caption.removeMovieClip();
	}
	duplicateMovieClip(_root.theCap, "caption", _root.getNextHighestDepth())
	startDrag(_root.caption, true);
}

But you may correct me if there is a better way :smiley: