Hi Everyone, I'm trying to pan my map every 1 second while a button is
depressed. Here is my code

private function onPanButtonMouseDown(evt:MouseEvent):void
{
        trace("[KM] :: Main :: onPanButtonMouseDown() :: start panning");

        if (evt.target == _panRightBtn)
        {
                panMap(1);
                _panInterval = setInterval(panMap, 1000, 1);
        }
        else if (evt.target == _panLeftBtn)
        {
                panMap( -1);
                _panInterval = setInterval(panMap, 1000, -1);
        }

        stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUp, false, 0,
true);
}

public function panMap(direction:int):void
{
        _currentLng += direction;

        if (_currentLng > MAX_LONGITUDE)
        {
                _currentLng = MIN_LONGITUDE;
        }

        if (_currentLng < MIN_LONGITUDE)
        {
                _currentLng = MAX_LONGITUDE;
        }

        _lngInputTextBox.text = _currentLng.toString();

        _map.flyTo(new LatLng(0, _currentLng), _map.getZoom(), new
Attitude(0, 0, 1), 1);
        _mapCopy1.panTo(new LatLng(0, _currentLng));
        _mapCopy2.panTo(new LatLng(0, _currentLng));
}

When I run this, after about the 2nd or 3rd iteration of the interval
I get this error:
TypeError: Error #1010: A term is undefined and has no properties.
        at com.google.maps.core::Interpolator/appendSegmentsCubic()
        at com.google.maps.core::FlyController/addSegment()
        at com.google.maps.core::MapImpl/flyTo()
        at com.google.maps::Map3D/flyTo()
        at Main/panMap()
        at Main/onPanButtonClicked()


I used to have it as each individual click of the button ran the
panMap function, and I would still get that error randomly. Anyone
know how to fix this?

Kyle

-- 
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.

Reply via email to