13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Displaying HTML cont<strong>en</strong>t in mobile apps<br />

The loadURL() method loads a resource at the specified URL. You can use any URI scheme supported by the system<br />

web browser control, including: data:, file:, http:, https:, and javascript:. The app: and app-storage: schemes are not<br />

supported. AIR does not validate the URL string.<br />

The loadString() method loads a literal string containing HTML cont<strong>en</strong>t. The location of a page loaded with this<br />

method is expressed as:<br />

On Desktop: about:blank<br />

On iOS: htmlString<br />

On Android: the data URI format of the <strong>en</strong>coded htmlString<br />

The URI scheme determines the rules for loading embedded cont<strong>en</strong>t or data.<br />

Note: If the stage’s displayState property is set to FULL_SCREEN, in Desktop, you cannot type in a text field displayed<br />

in the StageWebView. However, in iOS and Android, you can type in a text field on StageWebView ev<strong>en</strong> if the stage’s<br />

displayState is FULL_SCREEN.<br />

The following example uses a StageWebView object to display Adobe’s website:<br />

package {<br />

import flash.display.MovieClip;<br />

import flash.media.StageWebView;<br />

import flash.geom.Rectangle;<br />

}<br />

URI scheme Load local resource Load remote<br />

resource<br />

public class StageWebViewExample ext<strong>en</strong>ds MovieClip{<br />

}<br />

var webView:StageWebView = new StageWebView();<br />

public function StageWebViewExample() {<br />

webView.stage = this.stage;<br />

webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight );<br />

webView.loadURL( "http://www.adobe.com" );<br />

}<br />

On Android devices, you must specify the Android INTERNET permission in order for the app to successfully load<br />

remote resources.<br />

In Android 3.0+, an application must <strong>en</strong>able hardware acceleration in the Android manifestAdditions elem<strong>en</strong>t of the<br />

AIR application descriptor to display plug-in cont<strong>en</strong>t in a StageWebView object. See Enabling Flash Player and other<br />

plug-ins in a StageWebView object.<br />

Last updated 6/6/2012<br />

Local XMLHttpRequest Remote XMLHttpRequest<br />

data: No Yes No No<br />

file: Yes Yes Yes Yes<br />

http:, https: No Yes No Same domain<br />

about: (loadString()<br />

method)<br />

No Yes No No<br />

1024

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!