Calling methods of a loaded Flex swf

Hi all!

I’m loading a swf made in pure Flex from a pure ActionScript project. The Flex swf implements an interface. I load that swf and then I try to call a method of the loaded Flex swf but it doesn’t work.

This is the Flex swf that I’m loading:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" implements="IApp" layout="absolute">
    <mx:Script>
        <![CDATA[
            public function init():void
            {
                trace( "INIT OK!!" );
            }
        ]]>
    </mx:Script>
</mx:Application>

This is the interface IApp:


package
{
    public interface IApp
    {
        function init():void;
    }
}

And this is how I load the Flex swf in the ActionScript pure project and try to call the init method:


package {

    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.URLRequest;
    import flash.text.*;

    public class PruebaGS extends Sprite
    {
        public var URL:String = new String( "FlexSWF.swf" );
        public var loader:Loader;
        
        public function PruebaGS()
        {
               loader = new Loader();
               loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
               loader.load( new URLRequest(URL));
        }
        
        public function completeHandler( evt:Event ):void
        {
            var movie:IApp = evt.target.content as IApp;
            movie.init();
        }
    }
}

The problem is that evt.target.content is of type _FlexSWF_mx_managers_SystemManager so it cannot be converted to IApp.

Does anyone know what is the problem?

Thanks!