Alternative to google map api, so that I can use it on a HTTPS/SSL encrypted website.

Posted by Zeeshan Rang on Stack Overflow See other posts from Stack Overflow or by Zeeshan Rang
Published on 2010-06-05T00:10:23Z Indexed on 2010/06/05 11:02 UTC
Read the original article Hit count: 624

Filed under:
|
|

I did find a solution for this on Google map api page, and I made the following changes as mentioned in it.

1.Use Google Maps API for Flash version 1.9a or later.

2.Add the following to your Flash application before the map is instantiated: Security.allowInsecureDomain("maps.googleapis.com");

Ref:http://code.google.com/apis/maps/faq.html#flash_ssl

My code looks like this, after the changes:

<mx:TitleWindow  verticalAlign="middle" horizontalAlign="center"
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:maps="com.google.maps.*" 
    width="1000" height="600" layout="absolute" backgroundAlpha="0" borderAlpha="0" borderThickness="0" 
    showCloseButton="true" close="PopUpManager.removePopUp(this);">

<mx:VBox width="70%" height="100%" >
                <maps:Map 
                    id="map" 
                    key="ABQIAAAA0L1JEoR6rWjh-BBQnLMtMBSVuZ5VlaqlIqiYPFMK_I5M2UTmHhSq_BJxLHiYcTDW9RxSF6HewNY7uA" 
                    mapevent_mapready="onMapReady(event)"
                    width="100%" height="100%" />
            </mx:VBox>
<mx:Script>
        <![CDATA[
            //import flashx.textLayout.formats.Direction;
            import mx.effects.AddItemAction;
            //import flashx.textLayout.factory.TruncationOptions;
            import mx.controls.Alert;
            import mx.managers.PopUpManager;
            import mx.rpc.events.ResultEvent;
            import com.adobe.serialization.json.JSON;

            import flash.events.Event;
            import com.google.maps.*;
            import com.google.maps.overlays.*;
            import com.google.maps.services.*;
            import com.google.maps.controls.ZoomControl;
            import com.google.maps.controls.PositionControl;
            import com.google.maps.controls.MapTypeControl;

            import com.google.maps.services.ClientGeocoderOptions;
            import com.google.maps.LatLng;
            import com.google.maps.Map;
            import com.google.maps.MapEvent;
            import com.google.maps.MapMouseEvent;
            import com.google.maps.MapType;
            import com.google.maps.services.ClientGeocoder;
            import com.google.maps.services.GeocodingEvent;
            import com.google.maps.overlays.Marker;
            import com.google.maps.overlays.MarkerOptions;
            import com.google.maps.InfoWindowOptions;

            private function onMapReady(event:MapEvent):void {
            Security.allowInsecureDomain("maps.googleapis.com");
              map.setCenter(new LatLng(41.651505,-72.094455), 13, MapType.NORMAL_MAP_TYPE);
              map.addControl(new ZoomControl());
              map.addControl(new PositionControl());
              map.addControl(new MapTypeControl());

              map.enableScrollWheelZoom();
                map.enableContinuousZoom();

            }
]]>
    </mx:Script>
</mx:TitleWindow>

But i still get the following error using this: The requested URL /mapsapi/publicapi?file=flashapi&url=https%3A%2F%2Fvirtual.c7beta.com%2Findex_cloud.swf&key=ABQIAAAA0L1JEoR6rWjh-BBQnLMtMBTW_Qkp6J0z76Etz3qzo8Hg3HdUQhSnD6lqp53NB0UrBmg5Xm2DlazWqA&v=1.18&flc=xt was not found on this server.

Any suggestions to what am I doing wrong here, what should i do to make this work.

Regards zee

© Stack Overflow or respective owner

Related posts about flex

Related posts about google