Guide How to put Google Maps in Flash cs4

Status
Not open for further replies.
How to put Google Maps in Flash cs4
Put google maps into your flash application in just 6 simple steps. You can download the sample code right here. Follow these steps in order to put google maps in to an swf file.

1 - Download the google maps api SDK from

http://maps.googleapis.com/maps/flash/release/sdk.zip.

2 - Create a new directory named “Google†at this location on your computer.

C:\Program Files\Adobe\Adobe Flash CS4\Common\Configuration\Components

3 - Place the map_1_9.swc extracted from the sdk.zip into this google directory. The map_1_9.swc is located inside the “lib†folder in the sdk. You need to copy this into the google directory you created in step 2.

4 - Launch Adobe Flash CS 4, and open windows->Components and you would be able to see the google maps library.

googlemaps.jpg


5 - Now you need to add this library into the library of your fla. Just Drag it onto the library of your fla.

mapslib.jpg


6 - Now you need to write this simple code in the actions panel.
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;

var map:Map = new Map();
map.key = “your_google_maps_api_keyâ€;
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
this.addChild(map);

function onMapReady(event:Event):void {
map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);
}

7 - Hit Ctrl+Enter and your DONE :D.

finalmaps.jpg
 
  • Like
Reactions: 1 person
Status
Not open for further replies.