| Property | Defined By | ||
|---|---|---|---|
| currentTab : int Windows + OSX only | WebView | ||
| tabDetails : Vector.<TabDetails> [read-only] | WebView | ||
| viewPort : Rectangle | WebView | ||
| visible : Boolean | WebView | ||
| Method | Defined By | ||
|---|---|---|---|
addCallback(functionName:String, closure:Function):void | WebView | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [override] | WebView | ||
addTab(initialUrl:URLRequest = null):void Windows + OSX only | WebView | ||
allowsMagnification():Boolean | WebView | ||
| WebView | |||
callJavascriptFunction(functionName:String, closure:Function = null, ... args):void | WebView | ||
capture(onComplete:Function, cropTo:Rectangle = null):void
Captures the webView to BitmapData. | WebView | ||
clearCache():void
Clears the browser cache. | WebView | ||
clearRequestHeaders():void
Clears any persistent requestHeaders added to URLRequest
| WebView | ||
closeDevTools():void
Close the Chromium dev tools
Disables Inspect Element on right click on OSX
On Android disconnects from chrome://inspect
| WebView | ||
closeTab(index:int):void Windows + OSX only | WebView | ||
deleteCookies():void
Deletes all cookies
| WebView | ||
dispose():void [static] Disposes the ANE | WebView | ||
evaluateJavascript(code:String, closure:Function = null):void | WebView | ||
focus():void | WebView | ||
go(offset:int = 1):void | WebView | ||
goBack():void
Navigates back. | WebView | ||
goForward():void
Navigates forward. | WebView | ||
init(stage:Stage, viewPort:Rectangle, initialUrl:URLRequest = null, settings:Settings = null, scaleFactor:Number = 1.0, backgroundColor:uint = 0xFFFFFFFF):void | WebView | ||
injectScript(code:String = null, scriptUrl:String = null, startLine:uint = 0):void | WebView | ||
load(url:URLRequest):void | WebView | ||
loadFileURL(url:String, allowingReadAccessTo:String):void | WebView | ||
loadHTMLString(html:String, baseUrl:URLRequest = null):void | WebView | ||
print():void
Prints the webView. | WebView | ||
printToPdf(savePath:String):void | WebView | ||
reload():void
Reloads the current page. | WebView | ||
reloadFromOrigin():void
Forces a reload of the page (i.e. | WebView | ||
removeCallback(functionName:String):void | WebView | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [override] | WebView | ||
[static] | WebView | ||
showDevTools():void
Shows the Chromium dev tools on Windows
Enables Inspect Element on right click on OSX
On Android use Chrome on connected computer and navigate to chrome://inspect
| WebView | ||
stopLoading():void
Stops loading the current page. | WebView | ||
zoomIn():void
Zooms in
| WebView | ||
zoomOut():void Zooms out | WebView | ||
| currentTab | property |
currentTab:intWindows + OSX only
public function get currentTab():int public function set currentTab(value:int):void| tabDetails | property |
tabDetails:Vector.<TabDetails> [read-only] public function get tabDetails():Vector.<TabDetails>| viewPort | property |
viewPort:Rectangle public function get viewPort():Rectangle public function set viewPort(value:Rectangle):void| visible | property |
visible:Boolean
public function get visible():Boolean public function set visible(value:Boolean):void| addCallback | () | method |
public function addCallback(functionName:String, closure:Function):void
Parameters
functionName:String — name of the function as called from Javascript
| |
closure:Function — Actionscript function to call when functionName is called from Javascript
Adds a callback in the webView. These should be added before .init() is called.
|
| addEventListener | () | method |
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false) | |
priority:int (default = 0) | |
useWeakReference:Boolean (default = false) |
| addTab | () | method |
public function addTab(initialUrl:URLRequest = null):voidWindows + OSX only
Parameters
initialUrl:URLRequest (default = null) |
| allowsMagnification | () | method |
public function allowsMagnification():BooleanReturns
Boolean — Whether the page allows magnification functionality
Ignored on iOS.
|
| backForwardList | () | method |
public function backForwardList():BackForwardListReturns
BackForwardList —
Ignored on Windows and Android. |
| callJavascriptFunction | () | method |
public function callJavascriptFunction(functionName:String, closure:Function = null, ... args):void
Parameters
functionName:String — name of the Javascript function to call
| |
closure:Function (default = null) — Actionscript function to call when Javascript functionName is called. If null then no
actionscript function is called, aka a 'fire and forget' call.
| |
... args — arguments to send to the Javascript function
Call a javascript function. |
// Logs to the console. No result expected.
webView.callJavascriptFunction("as_to_js",asToJsCallback,1,"a",77);
public function asToJsCallback(jsResult:JavascriptResult):void {
trace("asToJsCallback");
trace("jsResult.error", jsResult.error);
trace("jsResult.result", jsResult.result);
trace("jsResult.message", jsResult.message);
trace("jsResult.success", jsResult.success);
var testObject:= jsResult.result;
trace(testObject);
}
// Calls Javascript function passing 3 args. Javascript function returns an
// object which is automatically mapped to an
// Actionscript Object
webView.callJavascriptFunction("console.log",null,"hello console. The is AIR");
// function in HTML page
function as_to_js(numberA, stringA, numberB, obj) {
var person = {
name: "Jim Cowart",
response: {
name: "Chattanooga",
population: 167674
}
};
return person;
}
| capture | () | method |
public function capture(onComplete:Function, cropTo:Rectangle = null):voidCaptures the webView to BitmapData.
Parameters
onComplete:Function — function(result:BitmapData)
| |
cropTo:Rectangle (default = null) — optionally crops to the supplied Rectangle
|
| clearCache | () | method |
public function clearCache():voidClears the browser cache. Available on iOS, OSX, Android only.
Ignored on Windows.
You cannot clear the cache on Windows while CEF is running. This is a known limitation. You can delete the contents of the value of your settings.cef.cachePath using Actionscript only before you call .init(). Calling after .dispose() may cause file locks as the files may still be 'owned' by the CEF process
| clearRequestHeaders | () | method |
public function clearRequestHeaders():voidClears any persistent requestHeaders added to URLRequest
| closeDevTools | () | method |
public function closeDevTools():voidClose the Chromium dev tools
Disables Inspect Element on right click on OSX
On Android disconnects from chrome://inspect
| closeTab | () | method |
public function closeTab(index:int):voidWindows + OSX only
Parameters
index:int |
| deleteCookies | () | method |
public function deleteCookies():voidDeletes all cookies
| dispose | () | method |
public static function dispose():voidDisposes the ANE
| evaluateJavascript | () | method |
public function evaluateJavascript(code:String, closure:Function = null):void
Parameters
code:String — Javascript string to evaluate.
| |
closure:Function (default = null) — Actionscript function to call when the Javascript string is evaluated. If null then no
actionscript function is called, aka a 'fire and forget' call.
|
// Set the body background to yellow. No result expected
webView.evaluateJavascript('document.getElementsByTagName("body")[0].style.backgroundColor = "yellow";');
// Retrieve contents of div. Result is returned to Actionscript function 'onJsEvaluated'
webView.evaluateJavascript("document.getElementById('output').innerHTML;", onJsEvaluated)
private function onJsEvaluated(jsResult:JavascriptResult):void {
trace("innerHTML of div is:", jsResult.result);
}
| focus | () | method |
public function focus():void| go | () | method |
public function go(offset:int = 1):void
Parameters
offset:int (default = 1) — Navigate forward (eg +1) or back (eg -1)
|
| goBack | () | method |
public function goBack():voidNavigates back.
| goForward | () | method |
public function goForward():voidNavigates forward.
| init | () | method |
public function init(stage:Stage, viewPort:Rectangle, initialUrl:URLRequest = null, settings:Settings = null, scaleFactor:Number = 1.0, backgroundColor:uint = 0xFFFFFFFF):void
Parameters
stage:Stage | |
viewPort:Rectangle | |
initialUrl:URLRequest (default = null) — Url to load when the view loads
| |
settings:Settings (default = null) | |
scaleFactor:Number (default = 1.0) — iOS, Android only
| |
backgroundColor:uint (default = 0xFFFFFFFF) — value of the view's background color in ARGB format.
Initialises the webView. N.B. The webView is set to visible = false initially. |
| injectScript | () | method |
public function injectScript(code:String = null, scriptUrl:String = null, startLine:uint = 0):void
Parameters
code:String (default = null) — Javascript to inject, if any.
| |
scriptUrl:String (default = null) — is the URL where the script in question can be found, if any. Windows only
| |
startLine:uint (default = 0) — is the base line number to use for error reporting. Windows only
Specify either code or scriptUrl. These are injected into the main Frame when it is loaded. Call before load() method Ignored on Android. |
| load | () | method |
public function load(url:URLRequest):void
Parameters
url:URLRequest |
| loadFileURL | () | method |
public function loadFileURL(url:String, allowingReadAccessTo:String):void
Parameters
url:String — full path to the file on the local file system
| |
allowingReadAccessTo:String — path to the root of the document
Loads a file from the local file system into the webView.
|
| loadHTMLString | () | method |
public function loadHTMLString(html:String, baseUrl:URLRequest = null):void
Parameters
html:String — HTML provided as a string
| |
baseUrl:URLRequest (default = null) — url which will display as the address
Loads a HTML string into the webView.
|
| () | method |
public function print():voidPrints the webView.
Windows and macOS 11.0+ only.
| printToPdf | () | method |
public function printToPdf(savePath:String):void
Parameters
savePath:String — path to save the pdf to.
Prints the webView to a pdf.
Windows and macOS 11.0+ only. |
| reload | () | method |
public function reload():voidReloads the current page.
| reloadFromOrigin | () | method |
public function reloadFromOrigin():voidForces a reload of the page (i.e. ctrl F5)
| removeCallback | () | method |
public function removeCallback(functionName:String):void
Parameters
functionName:String — name of the function to remove. This function should have been added via .addCallback() method
|
| removeEventListener | () | method |
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false) |
| shared | () | method |
| showDevTools | () | method |
public function showDevTools():voidShows the Chromium dev tools on Windows
Enables Inspect Element on right click on OSX
On Android use Chrome on connected computer and navigate to chrome://inspect
| stopLoading | () | method |
public function stopLoading():voidStops loading the current page.
| zoomIn | () | method |
public function zoomIn():voidZooms in
| zoomOut | () | method |
public function zoomOut():voidZooms out