Skip to main content
May 27, 2013
Question

load local html on iOS, width event handling

  • May 27, 2013
  • 1 reply
  • 990 views

Hi,

I need to donwload/update and load presentations on iPad. Working with external .swf resulted with uncontrolled crash of application. Im looking for rescue in HTML & JS build presentation.

I'm trying to find solution, that allow me to load .html file from applicationStorageDirectory, and capture events, like window.status in HTMLHost & HTMLLoader, but:

- HTMLloader is not supported on iOS (code that works for desktop, doesn't work for iOS distribution)

- WebStageView doesn't allow me to interact with app, only historyBack()/historyForward()

Does anybody try with success to load and interact html in AIR on iOS, and can shere the solution with others?

This topic has been closed for replies.

1 reply

Participating Frequently
September 16, 2013

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/