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

addToStage() and removeFromStage() not available. How to re-use WebView in my app? #139

Closed daghendrik closed 6 years ago

daghendrik commented 6 years ago

Hi, Thanks for this awesome repo and for keeping it up to date.

I am developing a Windows app using:

I have a popup-window in my app (Flex3 mx:Window) where I initialize and add an instance of WebView to an empty mx:Canvas, playing some YouTube videos. This works fine the first time I create the popup-window, but crashes the app if I close the popup and then open it again. I do the necessary cleanup (calling dispose on both the WebView and CommonDependencies instances). I read in the Wiki that the Cef view and processes can only be attached once to my app, so it's no wonder it crashes. The suggested solution in the wiki is to re-use the WebView instance using addToStage() and removeFromStage(), however these functions are not available on WebViewANE v.1.5.0.

How can I safely re-use the Cef view and processes in a Windows app with v.1.5.0 and newer?

If I want to add the Cef view to different mx:Window's inside my app, then I suppose I should create some Cef View Singleton service and inject this into my windows upon creation?

esidegallery commented 6 years ago

Hi, I believe you can just use the webView.visible property, loading an empty URL to clear it when hiding.

On 11 April 2018 at 12:47, daghendrik notifications@github.com wrote:

Hi, Thanks for this awesome repo and for keeping it up to date.

I am developing a Windows app using:

  • Flex 4.6.0 with AIR SDK 29
  • Packaging using Captive Runtime (32bit).
  • WebViewANE 1.5.0 (using cef_libs_x86, 32bit)
  • Developing on Windows 10 64bit using IntelliJ IDEA

I have a popup-window in my app (Flex3 mx:Window https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/Window.html) where I initialize and add an instance of WebView to an empty mx:Canvas, playing some YouTube videos. This works fine the first time I create the popup-window, but crashes the app if I close the popup and then open it again. I do the necessary cleanup (calling dispose on both the WebView and CommonDependencies instances). I read in the Wiki https://github.com/tuarua/WebViewANE/wiki/5.-Important-Notes that the Cef view and processes can only be attached once to my app, so it's no wonder it crashes. The suggested solution in the wiki is to re-use the WebView instance using addToStage() and removeFromStage(), however these functions are not available on WebViewANE v.1.5.0.

How can I safely re-use the Cef view and processes in a Windows app with v.1.5.0 and newer?

If I want to add the Cef view to different mx:Window's inside my app, then I suppose I should create some Cef View Singleton service and inject this into my windows upon creation?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tuarua/WebViewANE/issues/139, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVnA3kCl9-eGmOh52TwXX0ddqqvZcPAks5tne1qgaJpZM4TP4OV .

--

e side gallery 07966 057326

daghendrik commented 6 years ago

OK, thanks. I suppose its not possible to change the viewPort/dimensions (passed in with com.tuarua.webview.Settings) once the webView is initialized?

If possible, I'd like to use the WebView in different parts of my app (each part having its own unique viewport/dimensions.

esidegallery commented 6 years ago

Just set the viewport property before making it visible again.

On 11 April 2018 at 15:25, daghendrik notifications@github.com wrote:

OK, thanks. I suppose its not possible to change the viewPort/dimensions (passed in with com.tuarua.webview.Settings) once the webView is initialized?

If possible, I'd like to use the WebView in different parts of my app (each part having its own unique viewport/dimensions.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuarua/WebViewANE/issues/139#issuecomment-380471199, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVnAwCHqV26CsMXgIlNu-GDji8EhOLOks5tnhJCgaJpZM4TP4OV .

--

e side gallery 07966 057326

daghendrik commented 6 years ago

Thanks, seems like this will do the trick for me.