Skip to content

Instantly share code, notes, and snippets.

@marchbold
Last active August 29, 2015 14:25
Show Gist options
  • Save marchbold/b2772672871317f64cf5 to your computer and use it in GitHub Desktop.
Save marchbold/b2772672871317f64cf5 to your computer and use it in GitHub Desktop.
Create a WebView and display a web page using the NativeWebView ANE
var viewPort:Rectangle = new Rectangle( 0, 0, 400, 600 );
var webView:WebView = NativeWebView.service.createWebView( viewPort ) ;
webView.addEventListener( NativeWebViewEvent.LOCATION_CHANGE, webView_locationChangeHandler );
webView.addEventListener( NativeWebViewEvent.COMPLETE, webView_completeHandler );
webView.addEventListener( NativeWebViewEvent.ERROR, webView_errorHandler );
webView.loadURL( "http://airnativeextensions.com" );
...
private function webView_locationChangeHandler( event:NativeWebViewEvent ):void
{
trace( "location change: " + event.data );
}
private function webView_completeHandler( event:NativeWebViewEvent ):void
{
trace( "load complete: " + event.data );
}
private function webView_errorHandler( event:NativeWebViewEvent ):void
{
trace( "error: " + event.data );
}
// com.distriqt.NativeWebView
@marchbold
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment