Google Maps can be easily integrated into Flash with an API key for the application's domain. Though, since each Google Maps API key can only be assigned to one domain, if your website contains two domains reading the same server (example: www.mysite.com and www.mysite.org), you will need two separate API keys for each domain. While ideally I'd prefer to redirect one domain to the other, this isn't always the case for how a client wants their site to read. In order for the SWF file containing Google Maps to load successfully in multiple domains, the ActionScript file needs to be edited accordingly. Though the final result can also be achieved using a combination of JavaScript and ExternalInterface in Flash, I found it easiest to use AS3's LocalConnection to convert the SWF's domain into a String and then indexed with an if/else statement to decide with API key ActionScript should use:
import flash.net.LocalConnection; var lc:LocalConnection = new LocalConnection(); var domain:String = lc.domain; if (domain.indexOf("com") != -1) { map.key = "key-A"; } else { map.key = "key-B"; } map.setSize(new Point(P1, P2)); map.addEventListener(MapEvent.MAP_READY, onMapReady); swfMovieClip.addChild(map);
More information on Google Maps API.






