Google Map TypeError

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Google Map TypeError

minci
Flex Version : Apache Flex SDK 4.16.0 / AIR version 25.0 / Flash Player 25
Maps JavaScript API version : 3.28

Main.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx"
                       addedToStage="addedToStageHandler(event)">
    <fx:Script>
        <![CDATA[
        import mx.events.FlexEvent;

        protected var stageWebView:StageWebView;

        protected function addedToStageHandler(event:Event):void
        {
            stageWebView = new StageWebView();
            stageWebView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
            stageWebView.stage = stage;
            stageWebView.loadURL("file:\\C:/work/MapTest/src/assets/googlemap.html");
            stageWebView.addEventListener(ErrorEvent.ERROR, onWebViewError);
        }

        private static function onWebViewError(ev:Event):void
        {
            trace('Error' + ev);
        }

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);

            if (stageWebView)
                stageWebView.viewPort = new Rectangle(0, 0, unscaledWidth, unscaledHeight);
        }
        ]]>
    </fx:Script>
</s:WindowedApplication>



googlemap.html:
<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">

    <style>
      #map {
        height: 100%;
      }
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var map;
      function initMap() {
       map = new google.maps.Map(document.getElementById('map'), { zoom: 8,
          center: {lat: -34.397, lng: 150.644}
        });
      }
    </script>
    <script src="https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28"
    async defer></script>
  </body>
</html>


Error message:
TypeError: Result of expression 'b' [null] is not an object.
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 45
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 46
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 44
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 107
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 47
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 61
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 112
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 112
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 90
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 90
TypeError: Result of expression 'a.lat' [undefined] is not a function.
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 107
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 122
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 41
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 105
 at https://maps.googleapis.com/maps-api-v3/api/js/28/18/intl/de_ALL/map.js : 61
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 93
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 107
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 53
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 107
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 55
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 107
 at https://maps.googleapis.com/maps/api/js?callback=initMap&v=3.28 : 32

Can anyone help?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Map TypeError

bilbosax
Is there more code than what you have included here?  I am only asking because I don't see a mention of expressions "b" or "a.lat" in your code, even though they are mentioned in the error.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Map TypeError

minci
This post has NOT been accepted by the mailing list yet.
No, that's all, please try to execute.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Map TypeError

bilbosax
minci, I copied your code into an AIR project with the sdk that you specified exactly as you posted it.  The only change that I made is that I had to put in a different address to my .html file for the project.  The code works for me just fine.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Map TypeError

minci
Hi bilbosax,
Thanks for your quick answer.
Yes, I’m also able to show the map but the problem is I can’t move in the map.
Please move the mouse pointer in to the map and then click the left button (hold it pressed) and try to move in the card.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Map TypeError

MilanP
Just remove v=3.28 from your url.
Loading...