tuarua / WebViewANE

WebView Adobe Air Native Extension for macOS 10.10+, Windows Desktop, iOS 9.0+ and Android 19+. This ANE provides access to a more modern webview from AIR.
Apache License 2.0
183 stars 53 forks source link

EdgeView For Flex(Air) #258

Closed Freyrair closed 4 years ago

Freyrair commented 4 years ago

Answer the below. DO NOT DELETE!!

tuarua commented 4 years ago

You need to set the engine if you are using Edge.

https://github.com/tuarua/WebViewANE/blob/master/example-desktop-complete/src/WebViewANESample.as#L149

Please study example-desktop-complete and the asdocs

Freyrair commented 4 years ago

First of all, thank you for your answer Question 1: Before asking the questions, my local project has set up engine, and I confirmed during debugging that it is set to WebEngine.EDGE, only a gray background was displayed on the screen, the web page can not successfully display and the exception information is not output.

※the Local codding source: var freSharpANE:FreSharp = new FreSharp(); // must create before all others var freSwiftANE:FreSwift = new FreSwift(); // must create before all others var webView:WebView;

var viewPort:Rectangle = new Rectangle(0, 0, 300, 300); var settings:Settings = new Settings(); settings.engine = (os.isWindows && os.majorVersion >= 10 && os.buildVersion >= 17134) ? WebEngine.EDGE : WebEngine.DEFAULT;

webView = WebView.shared(); webView.init(e.currentTarget.stage, viewPort, new URLRequest("https://html5test.com"), settings, 1.0, 0xFFF1F1F1); webView.visible = true;

Question 2: I have the following problems when I use chromium view. I hope you can help me answer them. There are the following functions in my flex project , click different buttons to call up different pop-up pages (load HTML content). Now I use chromium view to load the pop-up page content. First, clicking the first button, the first pop-up page can be displayed normally, and then the First pop-up window is closed. When I click the second button open the second popup window, WebView failed to load;

I tried the following, but failed: At the end of the first screen, WebView is unload; when the second screen pops up, WebView reloads (shared(); init()); 1).First popup-closeEvent: WebView.dispose (); FreSwift.dispose (); FreSharp.dispose ();

2).the second popup-openEvent: var freSharpANE:FreSharp = new FreSharp(); var freSwiftANE:FreSwift = new FreSwift();

webView = WebView.shared(); webView.init(e.currentTarget.stage, viewPort, new URLRequest("https://secondHtml.com"), settings, 1.0, 0xFFF1F1F1); webView.visible = true;

esidegallery commented 4 years ago

Not sure about question 1. I assume you’re running in Windows 10?

To answer question 2, you shouldn’t dispose the web view. It should be initialised once, then shown/hidden as needed.

Freyrair commented 4 years ago

Question 1: As you can guess, the running environment is windows 10. The system version is 2019. The Edgeview runs on window10. Does it need other system requirements?

Question 2: Now I open the pop up page using the Class (spark.components.Window). After the screen is completed, the webView is loaded to the popup window; I try to use the method [webView.load (newUrl)] can load other web page content again, but the content is loaded on the first popup Window. I guess the reason is that when the WebView is initially initialized, the stage is set for it. The next time load URL is used, the new content will be bound to the original Window's stage. Therefore, can we add another parameter stage to the load method to solve the above problem? Or can you suggest a better solution: after a new window pops up, use the WebView to load HTML content?

tuarua commented 4 years ago

As per the FAQS

Can I run multiple WebViews?

No. Only one instance of WebViewANE can be created and used.

However, the view can be shown and hidden when not in use via the visible setter/getter eg.

webView.visible = false;


Are multiple AIR windows supported?

No. There is no reliable way to attach the webview processes to AIR child windows.

Essentially you are assuming the WebView is like a Flash component. It's not. The WebView is a native component which is rendered into the AIR window. It appears above the Flash display list. It is technically a separate window running it's own process. It can only be used in your Main class and inited once per App.