I have a method: myMethod() {} that I want to make accessible to javascript. I've done a bit of research and found out you need to add a callback to ExernalInterface, so here's what I have done:
ExternalInterface.addCallback("invokeMyMethod", myMethod);
Now when I load up my web page with the flash on it, I get an error:
ReferenceError: Error #1065: Variable myMethod is not defined. at Main$cinit() at global$init()
myMethod is contained within the Main class... here is how Main.as looks:
package {
   import flash.external.ExternalInterface;
   import flash.events.Event;
   //import a bunch of other things...
   if( ExternalInterface.available ) {
      ExternalInterface.addCallback("invokeMyMethod", myMethod);
   }
   public class Main extends Sprite {
      //A bunch of other methods...
      public function myMethod(str:String):void { 
         //Do something here
      }
   }
}
I have no clue how to make ExernalInterface.addCallback realize that myMethod exists... Anyone have any ideas?
Thanks,
Matt
 
    