Search code examples
javascriptflashconstantsexternalinterface

External Interface Error


This is the code I am using to call a function calc in javascript:

import flash.external.ExternalInterface;

ExternalInterface.addCallback("asFunc", this, asFunc); 

function asFunc(str:String):Void {
    out.text = "JS > Hello " + str;
}

send_btn.addEventListener(MouseEvent.CLICK, clickListener);

function clickListener(eventObj:Object):Void {
    trace("click > " + mean.text);
    ExternalInterface.call("calc", mean.text);
}

but I get the following error:

1046: Type was not found or was not a compile-time constant: Void.

What am I doing wrong here? (I modified the example on live docs.)


Solution

  • Void should be lower-case.

    Like this:

    void