0 Replies Latest reply on Apr 12, 2010 9:58 AM by openadobe

    expose an interface to call methods

    openadobe

      Hi,

      I hav created a pure actionscript project which defines few methods.What i want to do is to expose an interface for the .swf file generated through this actionscript project created in flex to call swf's methods.This is the following code that i tried writing in mxml:

       

      <mx:Application>

       

      <mx:Script>

      import mx.managers.SystemManager;

       

      public function appload(e:event){

      var smAppload:SystemManager=SystemManager(e.target.content);

      //listen for the application.complete event
      smAppLoaded.addEventListener(FlexEvent.APPLICATION_COMPLETE, onAppComplete);
        }


                  private function onAppComplete(e:FlexEvent):void {
                      swfinterface = e.currentTarget.application as ISWFPlayer; //Her ISWFPlayer is the exposed interface

      }

       

      </mx:Script>

       

      <mx:SWFLoader id="contentloader" source="pureactionscript.swf " complete="appload(event)"/>

       

      what error i get is cannot convert AVM1Movie to mx.managers.SystemManager. as well as swfinterface is set to null.

      How can this be rectified??Or if possible cud anyone give me another solution for exposing the interface.

      Please let me know how to go about this!