smidwin / gmaps-api-as3

Automatically exported from code.google.com/p/gmaps-api-as3
0 stars 0 forks source link

Error #2044 when adding Marker #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a map
2. add a marker
3. get a Error #2044: Unhandled ErrorEvent:. text=Load error.

What is the expected output? What do you see instead?
i expect to get a marker on the map

What version of the product are you using? On what operating system?
Windows7, FLex 4.6.0 SDK

Please provide any additional information below.

        private function onReady_map(e:MapsEvents):void {
                var mopts:MarkerOptions = new MarkerOptions();
                mopts.position      = new LatLng(51.6054473, 5.6666801);
                mopts.map       = _map;

                var marker:Marker   = new Marker(mopts);
            }
        }

        private function onCenter_changed(e:MapsEvents):void {

        }

        protected override function init():void {
            //create map options
            var gopts:MapOptions    = new MapOptions();
            gopts.zoom      = 15;
            gopts.mapTypeId     = MapType.ROADMAP;
            gopts.center        = new LatLng(51.602666, 5.67461);

            //create map
            _map        = new Map();
            _map.goptions   = gopts;
            _map.viewport   = new Rectangle(0, 0, 640, 480);

            //listen to map events
            _map.addEventListener(MapsEvents.MAP_READY      , onReady_map);
            _map.addEventListener(MapsEvents.CENTER_CHANGED     , onCenter_changed);

            //add map to container
            addChild(_map);

            //super init
            super.init();
        }

Original issue reported on code.google.com by marijnvd...@gmail.com on 24 Apr 2013 at 1:21

GoogleCodeExporter commented 8 years ago
Adding the MarkerEvents.ADDED to the marker-instance solved the problem:

marker.addEventListener(MarkerEvents.ADDED, onMarker_added);
private function onMarker_added(e:MarkerEvents):void {
//nothing to do here, just listening to the event is enough
}

Original comment by marijnvd...@gmail.com on 24 Apr 2013 at 1:31