Greetings,
It's good to implement an interface in loaded SWF.
But if you are not familiar with interface's, you can make some raw fixes to it.
1. Child or say loaded SWF
-----------------------------------------
Say you have a function in child swf (loaded swf)'s document class as follow (for e.g:)
function sampleFunction():void
{
//do whatever is needed
}
-----------------------------
2. In parent Flex App, add code to load SWF:
-------------------------------------
/*Load in external swf */
var loadSwf:Loader = new Loader();
var requestSwf:URLRequest = new URLRequest("sample.swf");
// add complete handler
loadSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
loadSwf.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
loadSwf.load(requestSwf);
2. on load complete event of your external SWF, create complete handler as follows:
function onCompleteHandler (loadEvent:Event) {
// do whatever is needed
// type cast the loaded content as per document class or base class
// in following e.g. i am considering that your base class is MovieClip
(loadEvent.currentTarget.content as MovieClip).sampleFunction();
}
Let me know if it helps or not.