RSS

StageWebViewBridge is an extended version of flash.media.StageWebView

11 Sep

Communicate with StageWebView

It is not so easy to communicate with the page loaded inside the StageWebView. The object does not provide specifics API. Fortunately exist a class (StageWebViewBridge) developed to overcome the limitations of the standard StageWebView object. With StageWebViewBridgeit is possible to communicate bidirectionally with the hosted html page and so create something similar to PhoneGap with Flash AIR.

Waiting for the future AIR 2.7 (which could have yet problems in the video area if it does not implement StageVideo in iOS) this is the best solution I found to overcome the limitations of AIR for iOS.

It lets you:

  • Communicate Actionscript with Javascript.
  • Communicate Javascript with Actionscript.
  • Load local files and resources in a easy way.
  • Extend loadString method with AS3 – JS communication.

By example you can call javascript from as3

// call javascript with callack function
webView.bridge.call('someFunctionToCall', callBackFunction, ...arguments );

// reference local resources in a easy way
<img src="appfile:/image.png">

http://code.google.com/p/stagewebviewbridge/

 
Leave a comment

Posted by on September 11, 2011 in Adobe Air, Android, flash, iPhone

 

Leave a comment