0 Replies Latest reply on Mar 2, 2011 2:13 AM by ChristophFlex

    using google map polygon without map

    ChristophFlex Level 1



      i use a polygon ( com.google.maps.overlays.Polygon) in a value object (fieldData) besides other data, later in the programm the polygons are displayed in a google map.


      new FieldData(".....","1",new Polygon([
                          new LatLng(49.70624852,8.17595987),
                          new LatLng(49.70634712,8.17589098),
                          new LatLng(49.7063722,8.17708855),
                          new LatLng(49.70627548,8.17720608),
                          new LatLng(49.70624852,8.17595987)]



      i instantiate the value objects on programm start and i get this error:


      TypeError: Error #1009: Cannot access a property or method of a null object reference.
           at com.google.maps.overlays::Polygon()


      It seems like i get this error because there isnt a google map object existing at that time on programm start. so i changed my code to call this methode on programm start before creating my value_Objects:



      protected function initMap(): void
                          var map:Map = new Map();
                          map.key = "...................";
                          addElement( map );     


      it works! but i dont like the code, i dont need that map object at that time and not in the main component. so i made it invisible.... isnt there a better way to use polygons without having a map-object?