AS代码如下:
var webView:StageWebView = new StageWebView();
webView.stage = stage;webView.viewPort = new Rectangle( 0, 0, 480, 800);
webView.loadURL("http://127.0.0.1/mappoi.html")
setTimeout(aaa,2000);
function aaa()
{
webView.loadURL( "javascript:jsFun('ssss')");
}
webView.addEventListener( LocationChangeEvent.LOCATION_CHANGING,handleLocationChanging );
function handleLocationChanging( event:LocationChangeEvent ):void
{
trace(event.location,webView.title)
//var data:Object = JSON.decode( event.location );
//trace( "Width: " + data.width + ", Height: " + data.height );
}
JS代码如下:
function jsFun(a)
{
document.location = JSON.stringify({width:document.body.scrollWidth, height:document.body.scrollHeight});
}