Package | com.distriqt.extension.nativewebview |
Interface | public interface WebView extends flash.events.IEventDispatcher |
This describes the interface to a Web View created by a call to NativeWebView.service.createWebView
See also
Property | Defined By | ||
---|---|---|---|
canGoBack : Boolean [read-only]
Whether there is a previous page in the browsing history. | WebView | ||
canGoForward : Boolean [read-only]
Whether there is a next page in the browsing history. | WebView | ||
cookies : Object [read-only]
| WebView | ||
height : int
The height of the web view
| WebView | ||
htmlSource : String [read-only]
The HTML source of the current page
| WebView | ||
isHistoryBackEnabled : Boolean [read-only]
| WebView | ||
isHistoryForwardEnabled : Boolean [read-only]
| WebView | ||
isPrintSupported : Boolean [read-only]
If true then printing is supported of the current webview. | WebView | ||
location : String [read-only]
The URL of the current location
| WebView | ||
statusCode : int [read-only]
The HTML status code of the loaded page
| WebView | ||
title : String [read-only]
The HTML title value
| WebView | ||
userAgent : String
The user agent that loaded the current page
| WebView | ||
viewPort : Rectangle
Set the view port of the webview in native coordinates
| WebView | ||
visible : Boolean
Controls whether the view is currently visible. | WebView | ||
width : int
The width of the web view
| WebView | ||
x : int
The x position of the web view
| WebView | ||
y : int
The y position of the web view
| WebView |
Method | Defined By | ||
---|---|---|---|
clearCache():Boolean
Attempts to clear any cached data
| WebView | ||
dispose():void
Clears and removes the WebView from the stage, stopping any load operations. | WebView | ||
drawViewPortToBitmapData(bitmapData:BitmapData, callback:Function = null):void
Draws the WebView's view port to a bitmap. | WebView | ||
evaluateJavascript(script:String):String
Returns the result of running the script. | WebView | ||
historyBack():void
Navigates to the previous page in the browsing history
| WebView | ||
historyForward():void
Navigates to the next page in the browsing history
| WebView | ||
loadString(text:String, mimeType:String = text/html, baseUrl:String):void
Loads and displays the specified HTML string. | WebView | ||
Loads the page at the specified URL. | WebView | ||
pageDown(animated:Boolean = true):void
Moves the view down by one page (viewport height)
| WebView | ||
pageUp(animated:Boolean = true):void
Moves the view up by one page (viewport height)
| WebView | ||
print(options:PrintOptions):void
Displays the printing options for the current page. | WebView | ||
reload():void
Reloads the current page
| WebView | ||
scrollBy(x:Number, y:Number, animated:Boolean = true):void
Moves the displayed view by the specified amount
| WebView | ||
scrollTo(x:Number, y:Number, animated:Boolean = true):void
Moves the displayed view to the specified position
| WebView | ||
setFocus(focused:Boolean):void
Android only
| WebView | ||
stop():void
Halts the current load operation. | WebView |
Event | Summary | Defined By | ||
---|---|---|---|---|
Signals that the last load operation has completed | WebView | |||
Signals that an error has occurred | WebView | |||
This event is dispatched when a script running in the web page sends a message using the AirBridge. | WebView | |||
A response from evaluation of javascript on the current page. | WebView | |||
Dispatched when a target _blank link was clicked and the webview has a linkTargetAction set to block. | WebView | |||
Signals that the location property of the WebView object has changed. | WebView | |||
Signals that the location property of the WebView object is about to change. | WebView | |||
WebView |
canGoBack | property |
canGoBack:Boolean
[read-only]
Whether there is a previous page in the browsing history.
If true the historyBack
operation can be performed successfully.
public function get canGoBack():Boolean
canGoForward | property |
canGoForward:Boolean
[read-only]
Whether there is a next page in the browsing history.
If true the historyForward
operation can be performed successfully.
public function get canGoForward():Boolean
cookies | property |
cookies:Object
[read-only]
public function get cookies():Object
height | property |
height:int
The height of the web view
public function get height():int
public function set height(value:int):void
htmlSource | property |
htmlSource:String
[read-only]
The HTML source of the current page
public function get htmlSource():String
isHistoryBackEnabled | property |
isHistoryBackEnabled:Boolean
[read-only]
public function get isHistoryBackEnabled():Boolean
See also
isHistoryForwardEnabled | property |
isHistoryForwardEnabled:Boolean
[read-only]
public function get isHistoryForwardEnabled():Boolean
See also
isPrintSupported | property |
isPrintSupported:Boolean
[read-only]
If true then printing is supported of the current webview.
public function get isPrintSupported():Boolean
location | property |
location:String
[read-only]
The URL of the current location
public function get location():String
statusCode | property |
statusCode:int
[read-only]
The HTML status code of the loaded page
public function get statusCode():int
title | property |
title:String
[read-only]
The HTML title value
public function get title():String
userAgent | property |
userAgent:String
The user agent that loaded the current page
public function get userAgent():String
public function set userAgent(value:String):void
viewPort | property |
viewPort:Rectangle
Set the view port of the webview in native coordinates
public function get viewPort():Rectangle
public function set viewPort(value:Rectangle):void
visible | property |
visible:Boolean
Controls whether the view is currently visible.
Setting this to false
will remove the view from your application but still keep it active in the background.
public function get visible():Boolean
public function set visible(value:Boolean):void
width | property |
width:int
The width of the web view
public function get width():int
public function set width(value:int):void
x | property |
x:int
The x position of the web view
public function get x():int
public function set x(value:int):void
y | property |
y:int
The y position of the web view
public function get y():int
public function set y(value:int):void
clearCache | () | method |
public function clearCache():Boolean
Attempts to clear any cached data
ReturnsBoolean — |
dispose | () | method |
public function dispose():void
Clears and removes the WebView from the stage, stopping any load operations.
After this call the web view will be in an invalid state and any subsequent calls will have undefined results. You should remove all event listeners before calling this and set your reference to null afterwards.
webView.removeEventListener( NativeWebViewEvent.LOCATION_CHANGING, webView_locationChangingHandler ); webView.removeEventListener( NativeWebViewEvent.LOCATION_CHANGE, webView_locationChangeHandler ); webView.removeEventListener( NativeWebViewEvent.COMPLETE, webView_completeHandler ); webView.removeEventListener( NativeWebViewEvent.ERROR, webView_errorHandler ); webView.removeEventListener( NativeWebViewEvent.JAVASCRIPT_RESPONSE, webView_javascriptResponseHandler ); webView.dispose(); webView = null;
drawViewPortToBitmapData | () | method |
public function drawViewPortToBitmapData(bitmapData:BitmapData, callback:Function = null):void
Draws the WebView's view port to a bitmap.
Capture the bitmap and set the stage to null for displaying the content above the StageWebView object.
Note: The behavior of this method is not guaranteed for pages that contain plugin content (such as embedded PDF and SWF files).
This process is not synchronous. The bitmap data object may be rendered at a point after the execution of this function. Hence you should not use the bitmap data until either thecallback
function has been called or
the NativeWebViewEvent.DRAWVIEWPORT_COMPLETE
event has been dispatched.
Parameters
bitmapData:BitmapData — The BitmapData object on which to draw the visible portion of the WebView's view port
| |
callback:Function (default = null ) — Callback function executed when the bitmap data has been rendered
|
evaluateJavascript | () | method |
public function evaluateJavascript(script:String):String
Returns the result of running the script
.
This function will dispatch an event that contains the response from the evaluation of the Javascript.
Parameters
script:String — A JavaScript string to run
|
String |
See also
historyBack | () | method |
public function historyBack():void
Navigates to the previous page in the browsing history
historyForward | () | method |
public function historyForward():void
Navigates to the next page in the browsing history
loadString | () | method |
public function loadString(text:String, mimeType:String = text/html, baseUrl:String):void
Loads and displays the specified HTML string.
When the loadString() method is used, the location is reported as "about:blank". Only standard URI schemes can be used in URLs within the HTML string. The AIR URI schemes, "app:" and "app-storage:" are not allowed.
The HTML content cannot load local resources, such as image files. XMLHttpRequests are not allowed.
Only the "text/html" and "application/xhtml+xml" MIME types are supported.
Parameters
text:String — The string of HTML or XHTML content to display
| |
mimeType:String (default = text/html ) — The MIME type of the content, either "text/html" or "application/xhtml+xml"
| |
baseUrl:String —
|
loadURL | () | method |
public function loadURL(url:String, additionalHeaders:Vector.<Header> = null):void
Loads the page at the specified URL.
The URL can use the following URI schemes: http:, https:, file:, data:, javascript: Content loaded with the file: scheme can load other local resources.
Parameters
url:String | |
additionalHeaders:Vector.<Header> (default = null )
|
pageDown | () | method |
public function pageDown(animated:Boolean = true):void
Moves the view down by one page (viewport height)
Parameters
animated:Boolean (default = true )
|
pageUp | () | method |
public function pageUp(animated:Boolean = true):void
Moves the view up by one page (viewport height)
Parameters
animated:Boolean (default = true )
|
() | method |
public function print(options:PrintOptions):void
Displays the printing options for the current page.
iOS only
Parameters
options:PrintOptions — Display options for the printing options dialog
|
reload | () | method |
public function reload():void
Reloads the current page
scrollBy | () | method |
public function scrollBy(x:Number, y:Number, animated:Boolean = true):void
Moves the displayed view by the specified amount
Parameters
x:Number | |
y:Number | |
animated:Boolean (default = true )
|
scrollTo | () | method |
public function scrollTo(x:Number, y:Number, animated:Boolean = true):void
Moves the displayed view to the specified position
Parameters
x:Number | |
y:Number | |
animated:Boolean (default = true )
|
setFocus | () | method |
public function setFocus(focused:Boolean):void
Android only
Parameters
focused:Boolean |
stop | () | method |
public function stop():void
Halts the current load operation.
complete | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.COMPLETE
Signals that the last load operation has completed
error | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.ERROR
Signals that an error has occurred
javascriptMessage | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.JAVASCRIPT_MESSAGE
This event is dispatched when a script running in the web page sends a message using the AirBridge. This can be used to receive communications from Javascript.
data
will contain the javascript message.
javascriptResponse | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.JAVASCRIPT_RESPONSE
A response from evaluation of javascript on the current page.
data
will contain the javascript string result.
linkBlocked | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.LINK_BLOCKED
Dispatched when a target _blank link was clicked and the webview has a linkTargetAction set to block. This gives the developer a chance to handle the url in an alternative manner.
locationChange | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.LOCATION_CHANGE
Signals that the location property of the WebView object has changed.
locationChanging | Event |
com.distriqt.extension.nativewebview.events.NativeWebViewEvent
com.distriqt.extension.nativewebview.events.NativeWebViewEvent.LOCATION_CHANGING
Signals that the location property of the WebView object is about to change. A locationChanging event is dispatched whenever the location in the web view is going to change. You can call the preventDefault() method of the event object to cancel the default behavior.
touchTap | Event |
flash.events.TouchEvent
flash.events.TouchEvent.TOUCH_TAP