xperiments / stagewebviewbridge

Automatically exported from code.google.com/p/stagewebviewbridge
5 stars 2 forks source link

Google Maps API v.3.3 no longer displays markers #44

Open fmcguire opened 6 years ago

fmcguire commented 6 years ago

The update from Google Maps API v.3.2 to v.3.3 no longer displays markers and generates runtime errors when an HTML file containing a map is loaded in a Flex HTML component or a StageWebView, or by StageWebViewBridge.

The Flex HTML component uses the outdated AIR WebKit, while StageWebView offers the option to select either the AIR WebKit or the native browser's WebKit. (The StageWebViewBridge code uses the AIR WebKit. also.) The release of Google Maps API v.3.3 now requires a better WebKit than the AIR WebKit.

In an attempt to fix this issue, I added an extra param to the StageWebViewBridge constructor in my copy of es.xperiments.media.StageWebViewBridge.as to be able to select which WebKit to use:

public function StageWebViewBridge( xpos : uint = 0, ypos : uint = 0, w : uint = 400, h : uint = 400, autoUpdateProps : Boolean = true, nativeWebKit : Boolean = false )
{
    super();
    _autoUpdateProps = autoUpdateProps;
    _viewPort = new Rectangle( 0, 0, w, h );
    _view = new StageWebView( nativeWebKit ); // 'false' uses ARI WebKit, 'true' uses native browser's WebKit
    _view.viewPort = _viewPort;
...
}

Then to use the native browser's WebKit, in my AS3 code I call:

protected var webView:StageWebViewBridge;

protected function onDiskCacheEnd(e:StageWebviewDiskEvent):void {
    webView = new StageWebViewBridge(0, 0, this.width, this.height, false, true);
...
}

The markers will now appear fine with no errors.

Major Caveat: StageWebViewBridge was designed for the AIR WebKit. Using the native browser's WebKit breaks StageWebViewBridge's JS-to-AS3 callback functionality including DOM_READY, DEVICE_READY, and any custom callbacks you add. (The StageWebViewDiskEvents (START_DISK_PARSING, and END_DISK_PARSING) work OK.)

Thus, the problem with using the native browser's WebKit is that, while it is still possible to call JavaScript functions & pass data from AS3 to the HTML file loaded in StageWebViewBridge, the reverse is now broken (calls from JavaScript to AS3 functions do not work).

Attached below is a simple (non-Google Map API) project demonstrating the use of native browser WebKit in my edited StageWebViewBridge. (Flash Builder 4.6 / AIR 19) and this problem.

I'm currently looking into catching the LocationChangeEvent.LOCATION_CHANGING to see if there is any way to pass data from the HTML file to my app via this event.

Any suggestions?

TestStage.zip