Closed lgignoud closed 6 years ago
It is not possible to call js on the webview without a callback function. This is because the native code in Swift in OSX+iOS and C# for Windows both use async closures.
The most concise way is to use an inline closure ie
webView.evaluateJavascript("document.getElementById('output').innerHTML;",
function onJsEvaluated(jsResult:JavascriptResult):void {
//output
})
OK, thanks
Hi Tuarua, My understanding is that all communications with javascript is asynchrone, with a callback mechanism. In an AS3 algorithm, I have to call some Google Maps function (fromLatLngToPoint for example); previously I used the synchrone function ExternalInterface.call() in the browser. I port this code to Air, and it's not easy to make all the algorithm with callbacks. Do you think there is a way to call a javascript function and get the result synchronously through the WebView ? Best, Laurent