You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the below code I have the 'javascriptResponseHandler' function that should receive a message from the postMessage from the html when touched, but it's not triggering, am I missing something??
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In the below code I have the 'javascriptResponseHandler' function that should receive a message from the postMessage from the html when touched, but it's not triggering, am I missing something??
AS3:
import flash.media.StageWebView;
import flash.geom.Rectangle;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.desktop.NativeApplication;
import flash.events.DataEvent
import flash.events.*;
var WebView:StageWebView;
WebView = new StageWebView(true);
WebView.addEventListener(DataEvent.WEBVIEW_MESSAGE,javascriptResponseHandler );
WebView.addEventListener(Event.LOCATION_CHANGE,changed );
WebView.viewPort = null;
WebView.loadURL('https://www.silas-admin.eu/webpagetest/');
WebView.stage = this.stage;
WebView.viewPort = new Rectangle(0 ,0, stage.fullScreenWidth / 2, stage.fullScreenHeight);
WebView.addEventListener(DataEvent.WEBVIEW_MESSAGE,javascriptResponseHandler );
function javascriptResponseHandler(e:DataEvent){
trace('something coming back.....');
trace(e.data);
}
function changed(e:Event){
trace('different!!!')
}
sample html:
<title>Basic HTML5 document</title> <style> body{ width:100vw; height:100vh; } </style>Test
<script> document.body.addEventListener('click' , function (e) { console.log('touched!'); window.chrome.webview.postMessage('webViewMessage'); }, false); </script>Beta Was this translation helpful? Give feedback.
All reactions