Search code examples
javascriptactionscriptexternalinterfacethrow

Throwing an error in ActionScript and catching it with JavaScript


I am using the ExternalInterface to communicate between Flash and JavaScript using callbacks and the call method. I would like to throw an exception in ActionScript 3.0 and catch it in JavaScript and I was please wondering if there was anyway to do that?

Thank you very much, Rudy


Solution

  • Should be something like:

    try {
         // statements
    } catch (error:Error) {
         ExternalInterface.call(functionsName, error.message);
    }
    

    Where functionsName is the function that will get the error as a parameter.