protected function button1_clickHandler(event:MouseEvent):void
{
Security.allowDomain("*.googleapis.com");
Security.allowDomain("*.google.com");
var q : URLLoader = new URLLoader();
q.addEventListener(Event.COMPLETE, onGeocodingComplete);
q.load(new URLRequest('http://maps.googleapis.com/maps/api/geocode/json?latlng=40.548555,24.558466&sensor=false'));
}
protected function onGeocodingComplete(event : Event) : void
{
Alert.show('geocoding succeed');
}
我試着用上面的代碼,但它扔給我:Flex:securityError嘗試使用google api反轉地理代碼?
sandbox violationError #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation...
我怎麼能直接訪問反向地理編碼服務trought閃光?
因爲帶有Flash API的地理編碼器不能提供足夠的數據。
您可以使用JavaScript做地理編碼的東西,並通過數據使用ExternalInterface的 – Neil 2012-02-20 14:03:28
羅閃爍。主要想法是遠離Javascript。 - 在我的情況下,Javascript是這樣的:「儘量避免使用Javascript」:D(無論如何,對其他人來說這可能是個好主意) – 2012-02-20 15:26:14