0

我正在经历流行的安全沙箱违规行为......

我使用 Google Maps Flex API,现在我想访问 Google Geocoding API。为此,我使用 HTTPService:

<s:HTTPService id="geo_req" url="http://maps.googleapis.com/maps/api/geocode/xml?address={i_address}" result="geo_req_resultHandler(event)" />

但是我违反了沙盒安全性。所以我创建了 crossdomain.xml 为:

<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<allow-access-from domain="*" secure="false" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy> 

我使用 WAMP 服务器,可以通过键入http://localhost/crossdomain.xml来访问该文件……但我仍然无法访问该 url。

我怎样才能摆脱这个?

4

2 回答 2

0

您需要将 CrossDomain.xml 文件放在您将请求发送到的域中

于 2011-06-19T14:40:48.067 回答
0

您为什么不使用现有的类 ClientGeoCoder 对您的地址进行地理编码,而不是向 Google 站点发出 HTTP 请求?

您是否成功运行此链接上的示例:http ://code.google.com/p/gmaps-samples-flash/source/browse/trunk/samplecode/GeocodingSimple.mxml ?

于 2011-06-20T11:32:59.787 回答