-
1. Re: load local html on iOS, width event handling
simonschweizer Sep 16, 2013 2:56 PM (in response to mc418a)its not so easy. you can use webstageview. to call javscript from actionscript you have to do something like that this.webview.loadURL("javascript:myfunction('value'));"); notice that you have to call functions.
if you want to call as3 function from javascript you have to use somthing like that window.location.href = "myprotocoll:myfunction?parameter=test";
and in AS3 you need to catach this redirect:
this.webview.addEventListener(LocationChangeEvent.LOCATION_CHANGING,locationChanging);
public function locationChanging(evt:LocationChangeEvent):void
{
var currLocation : String = unescape( (evt as LocationChangeEvent).location );
switch( true )
{
// javascript calls actionscript
case currLocation.indexOf( 'myprotocoll') != -1:
parseCallBack( currLocation.split('myprotocoll' )[1] );
break;
}
evt.preventDefault();
}
this is small example I haven't testet it. I use my own JS-AS-Bridge to transfer images or paths, objects, usinge base64 encoding. You can also use http://code.google.com/p/stagewebviewbridge/
