How to use the WebView component (Starling version)
The WebView
class displays a native web browser control. The web browser is displayed in an overlay above Starling using flash.media.StageWebView
, but Feathers wraps StageWebView
in a way that allows this component to be positioned using local coordinates on any parent.
The
WebView
component cannot be used in the Adobe Flash Player plugin in a web browser. It is only available in Adobe AIR applications on mobile or desktop.
The Basics
First, let's create a WebView
control, resize it, and add it to the display list:
var browser:WebView = new WebView();
browser.width = 400;
browser.height = 300;;
this.addChild( browser );
To load a URL, simply call the loadURL()
function:
browser.loadURL( "https://feathersui.com/" );
If you prefer to display locally-generated HTML, call the loadString()
function instead:
browser.loadString( "<!doctype html><html><body><h1>Hello World</h1></body></html>" );