Problem checking against types

I have a project that’s going to get big soon, so need to solve this problem.

What I’m doing here is looping through a staged movieclip (the obj argument) that has a bunch of its own staged instances, looking for MCs that are of a class type (the type argument - a string such as “com.site.views.ClassA”) so that I can group them into objects.

All of this actually works fine. But the swf produced is being imported by a different, completely unrelated (tho in the same folder) project SWF. When it gets to this code, the if statement “is of class type” always fails, thus returning null objects.

Here’s the code:


		import com.site.views.ClassA;
		import com.site.views.ClassB;
.....
		protected var _dummyA:ClassA;
		protected var _dummyB:ClassB;

		protected function getChildrenByType(obj,type):Object {
			var returnedObj:Object = new Object();
			var classDef:Class = getDefinitionByName(type) as Class;
			for (var i=0; i<obj.numChildren; i++) {
				if (obj.getChildAt(i) is classDef) {
					returnedObj[obj.getChildAt(i).name] = obj.getChildAt(i);
				}
			}
			return returnedObj;
		}

One strange thing that might help someone help me figure this out - two different subclasses reuse this code. In order for this to work in the original, importable swf, one of the subclasses doesn’t require the dummy class instances, while the other (the one that fails), does require the dummy class instances. I didn’t quite understand why, but have a feeling I will soon.