Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Google Maps in Flash

New Here ,
Feb 24, 2010 Feb 24, 2010

Hi, I've been researching embedding google maps in Flash and have followed the Google Maps API developers guide (after downlaoding and installing the SDK and generating a key).  I'm currently using the foloowing code,m but it doesnt seem to work I'm not even seeing the map, and Im getting errors relating to the controls elements I've added.  Can anyone help?

import com.google.maps.LatLng;

import com.google.maps.Map;

import com.google.maps.MapEvent;

import com.google.maps.MapType;

import com.google.maps.Controls;

var map:Map = new Map();

map.key = "ABQIAAAAdrPixq2HTFFowI9qjk74wxRIyoY1_2mmZno9JS0jJW-gT85BPRRotnr4suVY_4iicnk27GnnECcjXQ";

map.setSize(new Point(stage.stageWidth, stage.stageHeight));

map.addEventListener(MapEvent.MAP_READY, onMapReady);

this.addChild(map);

function onMapReady(event:Event):void {

  map.addControl(new ZoomControl());

  map.addControl(new PositionControl());

  map.addControl(new MapTypeControl());

  map.setCenter(new LatLng(53.535192,-2.00475), 14, MapType.NORMAL_MAP_TYPE);

  var m:Marker = new Marker(new LatLng(53.535192,-2.00475));

  map.addOverlay(m);

}

TOPICS
ActionScript
3.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 24, 2010 Feb 24, 2010

Delete (this.) of the addChild line.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2010 Feb 24, 2010

Thanks but that doesnt seem to have made any difference.  I'm still getting the following error message when I try and publish the file...

Picture 3.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2010 Feb 26, 2010

Hi there. I downloaded the SDK myself and managed to solve your problem. It's because of your imports.

First of all make sure the .swc file is in your library ( found in the lib folder called "map_1_18" )

(Whilst in Flash) Press Ctrl+U to open up the preferences, then go to the Actionscript category and select "AS3 settings"

Press the red button to browse to your .swc file.

Also have the SDK in your directory.


Then change your imports to this;


import com.google.maps.LatLng;

import com.google.maps.overlays.Marker;

import com.google.maps.Map;

import com.google.maps.MapEvent;

import com.google.maps.MapType;

import com.google.maps.controls.*;

You forgot to add one, and also you were importing the Controls folder and not the contents. ...And your map should debug perfectly. Happy Mapping!as32.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 22, 2011 Feb 22, 2011

I'm having the following problem with Google Maps:

1. I have the structure of files, where index.swf - small SWF with basic code loading external contents.swf with lots of graphic assets and GoogleMaps code.

2. I link map_1_20.swc from the contents.swf and it is compiled well.

3. But when I launch index.swf, it loads contents.swf I get a runtime error at the place where Map class is initialized: VerifyError: Error #1014: Class com.google.maps::Map could not be found.

4. After a few trials and errors I figured out that if I add a path to map_1_20.swc in Publish Settings of index.fla it starts working properly.

But the problem is that I want to keep SWF compiled from index.fla small, but now I have about 60Kb added both to index.swf and contents.swf because both have path to map_1_20.swc.

I tried to link SWC as external library in index.fla (added path to map_1_20.swc in External library path field in Publish settings), but I then I have runtime errors again.

The interesting thing is that it worked when I set it up first!!! But then I started having runtime of no obvious reason. And if I set up 2 new files one loading another with Google Map it works too.

This makes me crazy!! What's wrong? How can I have Google Map working in SWF that is loaded inside other SWF.

Any ideas and advices appreciated! Thanks in advance!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 04, 2014 Sep 04, 2014
LATEST

Hello, I have very little experience and now that the Goggle Map/flash API was turned off I'm in need of the developer that could help with the transition of my project to the new Javascript API v3 - please help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines