Hello
I have no news about this, nobody have this problem ? Attached the
sample code that does not work (the classe Hotspot.as is not joined,
simply put it in comment)
Thanks a lot for your help
-------- Original Message --------
Subject: [Google Maps API For Flash] problem with enableScrollWheelZoom
on api1.20
Date: Tue, 18 Jan 2011 12:29:14 +0100
From: Riccardo Cohen <[email protected]>
Reply-To: [email protected]
Organization: Architecte du Logiciel
To: [email protected]
Hello
I have just run a small test with the new api 1.20 in flex builder 3,
and found a strange situation : by default the scroll wheel do not
change the zoom (it worked with 1.17)
So I added map.enableScrollWheelZoom() in mapready event, but it did not
change. I searched in forums and in this group but found no recent
message about this.
Thanks for your help, I need that function rather soon.
--
Riccardo Cohen
Architecte du Logiciel
http://www.architectedulogiciel.fr
BP 77536
37075 Tours Cedex 2
+33 (0)6.09.83.64.49
Membre du réseau http://www.reflexe-conseil-centre.org
--
You received this message because you are subscribed to the Google
Groups "Google Maps API For Flash" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en.
--
You received this message because you are subscribed to the Google Groups "Google
Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
preinitialize="preinit();" creationComplete="creationcomplete();" width="100%" height="100%">
<mx:Script><![CDATA[
import mx.containers.HBox;
import com.google.maps.interfaces.INavigationControl;
import mx.collections.ArrayCollection;
import flash.display.Sprite;
import flash.net.*;
import flash.events.*;
import mx.events.*;
import mx.controls.*;
import mx.collections.*;
import com.google.maps.*;
import com.google.maps.controls.*;
import com.google.maps.services.*;
import com.google.maps.overlays.*;
import com.google.maps.styles.*;
// http://code.google.com/apis/maps/documentation/flash/reference.html
// http://code.google.com/apis/maps/documentation/flash/tutorial-flexbuilder.html
//http://code.google.com/apis/maps/signup.html
public var apikey:String="ABQIAAAASGgy1AEaFfy_aWDVi-aV6xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSAPWBxXOzi5V7f4Q3eYNh-9uLd8A";//localhost
public var geocoder:ClientGeocoder=null;
public var direction:Directions=null;
//ADL
public function preinit():void
{
}
//ADL
public function creationcomplete():void
{
}
//ADL
public function onMapPreinitialize(event:Event):void
{
var myMapOptions:MapOptions = new MapOptions();
myMapOptions.zoom = 14;
myMapOptions.center = new LatLng(47.401,0.691);
myMapOptions.mapType = MapType.NORMAL_MAP_TYPE;
map.setInitOptions(myMapOptions);
}
//ADL
public function onMapReady(event:MapEvent):void
{
//map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);
map.openInfoWindow(map.getCenter(), new InfoWindowOptions({title:"This is the map center",height:150,width:150,
contentHTML: "texte <font color='#FF0000'><b>texte</b></font><br>"+
"<img src='http://www.architectedulogiciel.fr/Resources/drapeautibetsmal.jpeg'><br>"+
"texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte "}));
map.addEventListener(MapMouseEvent.CLICK,onMapClick);
map.addControl(new ZoomControl());
map.addControl(new PositionControl());
map.addControl(new MapTypeControl());
geocoder=new ClientGeocoder()
geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, handleGeocodingSuccess);
geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, handleGeocodingFailure);
direction=new Directions();
direction.addEventListener(DirectionsEvent.DIRECTIONS_SUCCESS, handleDirectionSuccess);
direction.addEventListener(DirectionsEvent.DIRECTIONS_FAILURE, handleDirectionFailure);
map.enableScrollWheelZoom();
}
//ADL
public function toggledrag():void
{
if (blockdragbox.selected)
map.disableDragging();
else
map.enableDragging();
}
//ADL
public function addmarker():void
{
var pos:LatLng=new LatLng(47.39462602646791,0.6899241733551209);//grand theatre de tours
map.addOverlay(createMarker(pos,"Tours big theater",true));
}
//ADL
public function onMapClick(event:MapMouseEvent):void
{
output.text="clicked la:"+event.latLng.lat()+" lo:"+event.latLng.lng();
}
//ADL
public function doGeocode():void
{
if (geocoder!=null)
geocoder.geocode(geocodeinput.text);
}
//ADL
public function doDrive():void
{
if (direction!=null)
direction.load("from: "+geocodeinput.text+" to: "+directioninput.text);
}
//ADL
public function handleGeocodingSuccess(event:GeocodingEvent):void
{
var placemarks:Array = event.response.placemarks;
if (placemarks.length > 0)
{
map.closeInfoWindow();
map.setCenter(placemarks[0].point,13);
map.addOverlay(createMarker(placemarks[0].point,"Géocoding "+event.response.name,false));
}
}
//ADL
public function handleGeocodingFailure(event:DirectionsEvent):void
{
Alert.show("Geocoding failure");
}
//ADL
public function handleDirectionSuccess(event:DirectionsEvent):void
{
map.addOverlay(event.directions.createPolyline());
}
//ADL
public function handleDirectionFailure(event:GeocodingEvent):void
{
Alert.show("Direction failure");
}
//ADL
// try this function with many window sizes
public function showParis():void
{
var zm:int=map.getMapTypes()[0].getSpanZoomLevel(
new LatLng(48.85893416629113,2.340236679077159), // paris center
new LatLng(48.90262233347991-48.815207834357246,
2.4166259918212996-2.2506294403076277),// paris size
new Point(map.width,map.height)// pixel current map size
);
map.setCenter(new LatLng(48.85893416629113,2.340236679077159),zm);
}
//ADL
public function createMarker(latlng:LatLng,title:String,movable:Boolean):Marker
{
var options:MarkerOptions=new MarkerOptions();
//options.strokeStyle=new StrokeStyle({color: 0x987654});
//options.fillStyle=new FillStyle({color: 0x223344, alpha: 0.8});
//options.radius=12;
//options.hasShadow=true;
options.draggable=movable;
options.iconAlignment=MarkerOptions.ALIGN_LEFT | MarkerOptions.ALIGN_TOP;// strange that this makes a center alignment on custom icons
options.iconOffset=new Point(0,0);
var hsp:Hotspot=new Hotspot;
if (!movable)
{
hsp.fillcolor1=0x55FF55;
hsp.fillcolor2=0x008800;
hsp.circlecolor=0x00FF99;
}
hsp.build();
hsp.startanim();// this is a problem if iconAlignment is not topleft, because while dragging the map, the marker is moved depending of its current size
options.icon=hsp;
var marker:Marker=new Marker(latlng,options);
marker.addEventListener(MapMouseEvent.CLICK, function(e:MapMouseEvent):void
{
map.openInfoWindow(marker.getLatLng(),new InfoWindowOptions({title:title,content:movable?"You can move this point":"FIXED POINT"}));
});
marker.addEventListener(MapMouseEvent.DRAG_START, function(event:Event):void
{
map.closeInfoWindow();
});
marker.addEventListener(MapMouseEvent.DRAG_END, function(event:Event):void
{
output.text="moved at la:"+marker.getLatLng().lat()+" lo:"+marker.getLatLng().lng();
});
return marker;
}
]]></mx:Script>
<mx:HBox width="100%" height="100%">
<mx:VBox height="100%">
<mx:TextArea id="output" width="100%" height="100"/>
<mx:CheckBox id="blockdragbox" label="Block Drag" click="toggledrag()"/>
<mx:Button label="AddMarker" click="addmarker()"/>
<mx:Label text="Geocode :"/>
<mx:TextInput id="geocodeinput" enter="doGeocode()" text="2 place des halles, tours, france"/>
<mx:Label text="Direction :"/>
<mx:TextInput id="directioninput" enter="doDrive()" text="2 place de la liberté, tours, france"/>
<mx:Button label="Show Paris at any window size" click="showParis()"/>
</mx:VBox>
<maps:Map xmlns:maps="com.google.maps.*" id="map"
mapevent_mapready="onMapReady(event)"
mapevent_mappreinitialize="onMapPreinitialize(event)"
width="100%" height="100%" key="{apikey}" sensor="false"/>
</mx:HBox>
</mx:Application>