How add HTML in adobe air (animate) for android and IOS


#1

I want load one HTML in movie Clip in adobe aire animate for application mobile
now I need Code + Sampel
:disappointed:
:kissing_heart:


#2

AS3LCR StageWebView

StageWebViewExample.1.as
The following example sets up a StageWebView object to fill the stage. The example loads a web site with the loadURL() method and uses the device Back and Search softkeys for history navigation.

package  {
    import flash.display.MovieClip;
    import flash.media.StageWebView;
    import flash.geom.Rectangle;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    import flash.desktop.NativeApplication;
                
    public class StageWebViewExample extends MovieClip{

        private var webView:StageWebView = new StageWebView();
                                
        public function StageWebViewExample() 
        {
            webView.stage = this.stage;
            webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight );
            webView.loadURL( "http://www.example.com" );
                                                
            stage.addEventListener( KeyboardEvent.KEY_DOWN, onKey );
        }
                                
        private function onKey( event:KeyboardEvent ):void
        {
            if( event.keyCode == Keyboard.BACK && webView.isHistoryBackEnabled )
            {
                trace("Back.");
                webView.historyBack();
                event.preventDefault();
            }

            if( event.keyCode == Keyboard.SEARCH && webView.isHistoryForwardEnabled )
            {
                trace("Forward.");
                webView.historyForward();
            }
        }
    }
}

All is there really

you can find more examples in the official doc


#3

:relaxed:
Thank you
BUT
your sample not help me!!:expressionless:

I got this code:

//This will return the actual width value of our stage
var wView: int = stage.stageWidth;

//This will return the actual height value of our stage
var hView: int = stage.stageHeight;

//---------------

//Create a new StageWebView object
var swv: StageWebView = new StageWebView();

//Set the size of StageWebView object created to match the screen size
swv.viewPort = new Rectangle(0, 0, wView, hView);

//-------------
//Load the Google Page
swv.loadURL("http://www.google.com");

//Show the StageWebView Object
//If you want to hide it, set the stage property to null

swv.stage = this.stage;

that show URL: https://www.google.com

But that does not show me my address URL !!!
my URL is:

http://www.motaharyhospital.com/Panorama/location/motahray_hospital_panorama.htm

if you tell me what do I do? it is very good
and + sampel whit my URL is very good :wink:


#4

[EDIT] sorry, ignore this - since you are on mobile :slight_smile:

try
var swv: StageWebView = new StageWebView(true);

useNative:Boolean (default = false) β€” When useNative is false, a version of WebKit embedded within AIR is used as the source of the StageWebView created. When useNative is true, then AIR will use the the system’s default web engine. Mobile platforms only support using the system web engine, so useNative is ignored on mobile platforms.

https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/StageWebView.html#StageWebView()


#5

is that a joke ?

when you see this

//Load the Google Page
swv.loadURL("http://www.google.com");

you don’t get that to display another URL than the one provided
you just have to change the … URL ?!?

it is all there in the doc

loadURL()

public function loadURL(url:String):void

Loads the page at the specified URL.

if you can not follow such basic thing I’m not sure anyone can help you.


#6

Hello
With your help now she is displayed in the simulator.

//This will return the actual width value of our stage
var wView:int = stage.stageWidth;
//This will return the actual height value of our stage
var hView:int = stage.stageHeight;

//--------------
//Create a new StageWebView object
var swv:StageWebView = new StageWebView(true);
//Set the size of StageWebView object created to match the screen size
swv.viewPort = new Rectangle(0,0,wView,hView);
//-------------
//Load the Google Page
swv.loadURL(β€œhttp://www.motaharyhospital.com/Panorama/location/motahray_hospital_panorama.htm”);
//Show the StageWebView Object
//If you want to hide it, set the stage property to null
swv.stage = this.stage;

But it does not load on mobile and it stops at the loading stage
I attach the source to it.

Check and guide me
Thank you so much
Source: source Load Web.zip
information: adobe Animate cc version 18
:SDK version 30


admin edit:
do not provide link to RAR file


#7

look at @Wizzy answer


#8

I looked at @Wizzy answer and added it to the project
Adding

var swv:StageWebView = new StageWebView(true);

is displayed in the simulator, but on Mobile (Android) no!
please look
source Load Web.zip

admin edit:
do not provide link to RAR file!!
final warning, if you continue to do that you will get banned
if you want to show source code to people use services like pastebin, github gist, etc.
see Why you should not open RAR files