How to use Google Maps API in flash
posted in /home/ActionScript on 2010-08-19 |
Google offers a lot of free tools for us. One of them is really useful and easy to work with - GoogleMaps API. In this article I will show you how to import a map in Flash and place an icon in a specific place.
First of all you have to download the necessary libraries. You can do that from here. In the zip file you will find "map_1_18.swc" file which you have to import in Flash. Basically .swc files are designed to be used in Flex, but you can still add them in any .fla file. Copy the file to your Components directory. For Windows(XP) users the folder is located here:
Note that there is a separate directory for each language supported in Flash CS3. Place the SWC within whatever language directory you will be authoring Flash content. In other words {language} in the line above could be "en" for example.
For Mac users:
You should restart Flash and open the Component panel (Ctrl+F7). The GoogleMapsLibraries should appear there.

Drag the GoogleMapsLibraries component to your Library panel (F11). Now all the necessary classes are automatically added and they are available for use. Here is the code of the application:
Please notice that you should have a valid key(line:37) to be able to use the api. You should generate your own key depending on your domain. It's free and you can do it here.
The result could be seen here. Source files are available here. A detailed information regarding the API is located here.
First of all you have to download the necessary libraries. You can do that from here. In the zip file you will find "map_1_18.swc" file which you have to import in Flash. Basically .swc files are designed to be used in Flex, but you can still add them in any .fla file. Copy the file to your Components directory. For Windows(XP) users the folder is located here:
Note that there is a separate directory for each language supported in Flash CS3. Place the SWC within whatever language directory you will be authoring Flash content. In other words {language} in the line above could be "en" for example.
For Mac users:
You should restart Flash and open the Component panel (Ctrl+F7). The GoogleMapsLibraries should appear there.

Drag the GoogleMapsLibraries component to your Library panel (F11). Now all the necessary classes are automatically added and they are available for use. Here is the code of the application:
Please notice that you should have a valid key(line:37) to be able to use the api. You should generate your own key depending on your domain. It's free and you can do it here.
The result could be seen here. Source files are available here. A detailed information regarding the API is located here.
Delicious