Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AIR – Google Maps API Security Sandbox Violation?

i've just started using the Google Maps API for Flash (map_1_20.swc) for an AIR 2.5 application i'm building with Flash CS5. everything loads and display fine in the ADL except that i'm receiving security sandbox violations:

*** Security Sandbox Violation ***
SecurityDomain 'http://maps.googleapis.com/mapsapi/publicapi?
file=flashapi&url=http%3A%2F%2FgMyDomainName.com&key=ABQIAAAAKlbBGDLCUgZLtxxJ6-
Hi9RQ7KOBhSjQi3kzVUu2XaSyicmBCGxQz68ixtUMxnYSMDFuMNT0cJYPwjQ&sensor=false&v=1.20&fl
pub=&flh=17e8cb187dcf0488fac63df6b16432b7592443ee&flc=at&flcl=a0g30ufvvrvvtvvbo03' 
tried to access incompatible context 'app:/MapTest.swf'

//MyDomainName.com represents my domain registered with the API key

the security sandbox violation is thrown wheneven i mouse in or out of the infoWindow.

here's my code for the document class

package
{
import com.google.maps.LatLng;
import com.google.maps.InfoWindowOptions;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import flash.display.Sprite;
import flash.events.Event;

public class MapTest extends Sprite
{
public function MapTest()
    {
    addEventListener(Event.ADDED_TO_STAGE, init);
    }

private function init(evt:Event):void
    {
    removeEventListener(Event.ADDED_TO_STAGE, init);

    var map:Map = new Map();
    map.key = "ABQIAAAAKlbBGDLCUgZLtxxJ6-Hi9RQ7KOBhSjQi3kzVUu2XaSyicmBCGxQz68ixtUMxnYSMDFuMNT0cJYPwjQ";
    map.url = "http://MyDomainName.com"; //MyDomainName.com represents my domain registered with the API key
    map.sensor = "false";
    map.width = stage.stageWidth;
    map.height = stage.stageHeight;     
    map.alpha = 0.0;

    map.addEventListener(MapEvent.MAP_READY, mapReadyEventHandler);
    map.addEventListener(MapEvent.TILES_LOADED, tilesLoadedEventHandler);
    addChild(map);
    }

private function mapReadyEventHandler(evt:MapEvent):void
    {
    trace("Map Ready");
    evt.currentTarget.removeEventListener(MapEvent.MAP_READY, mapReadyEventHandler);
    evt.currentTarget.setCenter(new LatLng(45.53329,-73.67638), 11, MapType.NORMAL_MAP_TYPE);
    }

private function tilesLoadedEventHandler(evt:MapEvent):void
    {
    trace("Tiles Loaded");
    evt.currentTarget.removeEventListener(MapEvent.TILES_LOADED, tilesLoadedEventHandler);
    evt.currentTarget.alpha = 1.0; //Create Fade In Here (Tween)

    evt.currentTarget.openInfoWindow(evt.currentTarget.getCenter(), new InfoWindowOptions({title: "Test Title", content: "Test Content."}));
    }
}

}

like image 705
Chunky Chunk Avatar asked Oct 30 '10 00:10

Chunky Chunk


People also ask

Is Google Maps API no longer free?

Note that the Maps Embed API, Maps SDK for Android, and Maps SDK for iOS currently have no usage limits and are at no charge (usage of the API or SDKs is not applied against your $200 monthly credit).

Can I use Google Maps API commercially?

If you want to use Google Maps, Google Earth or Street View for other commercial purposes – meaning “for sale or revenue-generating purposes” – please contact the Google Cloud Customer Team.


1 Answers

I think you might not have a cross-domain issues.

http://kb2.adobe.com/cps/142/tn_14213.html

like image 158
jc303 Avatar answered Sep 27 '22 02:09

jc303