Having trouble instantiating a class from another swf file

I have two SWF files.

DynamicModules.swf loads in CustomModules.swf

CustomModules.swf has a class “MyModule” defined in it.


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	<mx:Script>
		<![CDATA[
			private var m:MyModule = new MyModule;
		]]>
	</mx:Script>
</mx:Application>

MyModule is a pretty simple class


package
{
	import flash.display.Sprite;
	public class MyModule extends Sprite
	{
		public function MyModule()
		{
			super();
		}
	}
}

In my DynamicModules.swf, this is the loaded handler for the Loader.


private function moduleLoadedHandler(e:Event) : void{
	var moduleClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("MyModule") as Class;
}

This is returning a “variable is not defined” error. Any suggestions on what I might be doing wrong? I have a feeling it is something in CustomModule.swf but I don’t know what.

If I get the “Wrapper.swf” from this adobe site, which is suppposed to be the same thing, it loads fine. Unfortunately they didn’t include the source code for Wrapper.swf.