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
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
1
person has this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?I've had luck with this (where _map is the com.modestmaps.Map object):
_map.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
function mouseWheelHandler(e:MouseEvent):void {
if (e.delta < 0) {
_map.zoomOut();
}
else if (e.delta > 0) {
_map.zoomIn();
}
}
I’m hoping it works for you, too
Loading Profile...




