Get your own customer support community
 

MouseWheelZoomEvent

I just tried to add MouseWheel Zooming by patching com.modestmaps.core.TileGrid.as:

protected function buildWell():void
{
_well = new Sprite();
_well.name = 'well';

if (_draggable)
{
_well.mouseChildren = false;
_well.addEventListener(MouseEvent.MOUSE_DOWN, startWellDrag);
_well.addEventListener(MouseEvent.MOUSE_UP, stopWellDrag);
_well.addEventListener(MouseEvent.DOUBLE_CLICK, onWellDoubleClick);
_well.addEventListener(MouseEvent.MOUSE_WHEEL, onWellMouseWheel);
_well.doubleClickEnabled = true;
}

addChild(_well);
centerWell(false);
}

private function onWellMouseWheel(event:MouseEvent):void
{
if(positionTiles())
updateMarkers();

zoomBy(event.delta/5,true);
}

This works to some extend, but after varous zoom operations I get the following errors

Error: no reference tile in mergeTiles()
at com.modestmaps.core::TileGrid/com.modestmaps.core:TileGrid::mergeTiles()
at com.modestmaps.core::TileGrid/com.modestmaps.core:TileGrid::normalizeWell()
at com.modestmaps.core::TileGrid/zoomBy()
at com.modestmaps.core::TileGrid/private::onWellMouseWheel()

TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht möch.
at com.modestmaps.core::TileGrid/coordinatePoint()
at com.modestmaps::Map/locationPoint()
at com.modestmaps.core::MarkerClip/updateClip()
at com.modestmaps.core::MarkerClip/private::updateClips()
at com.modestmaps.core::MarkerClip/onMapStopPanning()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.modestmaps::Map/onStopPan()
at com.modestmaps.core::TileGrid/stopWellDrag()
at [stageEvent]
at [mouseEvent]

Anyone has the mouseWheel Zoom working without problems?

Cheers Mugdi
Inappropriate?
1 person has this problem

User_default_medium