views:

288

answers:

1

Hi stackers, my question today is dealing with the Google Maps Flash API.

I successfully created a basic map using Flash CS4 with the API here: http://gaban.com/googlemaps/

Now my problem is with the next basic tutorial dealing with a simple Info Window message. The Google DOCS example(FLEX) is here: "Hello World"

Documentation here: Google Maps Flash API (search for "Info Windows")

The example they show is this:

private function onMapReady(event:MapEvent):void {
map.setCenter(new LatLng(37.4419, -122.1419), 13, MapType.NORMAL_MAP_TYPE);
map.openInfoWindow(getCenter(), new InfoWindowOptions({title: "Hello", content: "World"}));
}

My code

import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.MapOptions;

// ☼ ----------------------------

var map:Map = new Map();
    map.key="My API Key";
    map.setSize(new Point(stage.stageWidth, stage.stageHeight));
    map.addEventListener(MapEvent.MAP_READY, onMapReady);

var stackLogo = new StackOverflow();
    stackLogo.x=290;
    stackLogo.y=329;

this.addChild(map);
this.addChild(stackLogo);


function onMapReady(event:Event):void {
    map.setCenter(new LatLng(37.4419, -122.1419), 14, MapType.NORMAL_MAP_TYPE);
    //map.openInfoWindow(getCenter(), new InfoWindowOptions({title: "Hello", content: "World"}));
}

^ The last commented line is the problematic line, it's also the exact same code in their example and I have all the listed imports so I don't know whats going on :(

The errors I'm getting are from the same line:

1180: Call to a possibly undefined method getCenter.

1180: Call to a possibly undefined method InfoWindowOptions.

+2  A: 

Looks like there is a typo on the page. Try

map.getCenter()

instead. See here: http://code.google.com/p/gmaps-samples-flash/source/browse/trunk/samplecode/MapInfoWindow.mxml for the full code.

Goose Bumper
Sweet! That worked! :D I hate it when the actual API/code devs make errors like that, drives you nuts X_X... thx again
Leon