1 Reply Latest reply on Sep 9, 2010 1:44 AM by rouncy_2010

    call methods using exposed interface

    openadobe Level 1

      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 {
                      kinterface = 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.

      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!