Jonathan - thanks for the idea & outlining the algorithm!

Hong007 - thanks for the working example. Works well!  Wouldn't be
hard to modify it to allow the scrolling to progressively slow but I
also like the ability to allow scrolling to continue until a mouse-
click stops it.

Regards,
Steve.

On Jun 9, 8:58 am, hong007 <[email protected]> wrote:
> I was easily similar.
>
> Source :http://cafe.naver.com/gisapplication/50
>
> ///////////////////////////////////////////////////////////////////////////-///////////////////////////////////////////////////////////////////////////-//////////////////////////////////
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute">
> <maps:Map xmlns:maps="com.google.maps.*"
>         id="map"  key="myKey"
>         mapevent_mapready="onMapReady(event)"
>         width="100%" height="100%"
>         left="0" top="0"/>
>         <mx:Button x="116" y="169" label="▶" click="OnBtnMapMove2(event)"
> height="30" width="47" id="Btn_Right0"/>
>         <mx:Button x="63" y="131" label="▲" click="OnBtnMapMove2(event)"
> height="30" width="51" id="Btn_UP0"/>
>         <mx:Button x="20" y="169" label="◀" click="OnBtnMapMove2(event)"
> height="30" width="45" id="Btn_Left0"/>
>         <mx:Button x="63" y="207" label="▼" click="OnBtnMapMove2(event)"
> height="30" width="51" id="Btn_Down0"/>
>
>         <mx:Button x="67" y="48" label="STOP" click="OnBtnSTOP()" height="30"
> width="47" id="Btn_STOP" fontWeight="normal" fontSize="8"/>
>         <mx:Button x="63" y="10" label="▲" click="OnBtnMapMove(event)"
> height="30" width="51" id="Btn_UP"/>
>         <mx:Button x="20" y="48" label="◀" click="OnBtnMapMove(event)"
> height="30" width="45" id="Btn_Left"/>
>         <mx:Button x="116" y="48" label="▶" click="OnBtnMapMove(event)"
> height="30" width="47" id="Btn_Right"/>
>         <mx:Button x="63" y="84" label="▼" click="OnBtnMapMove(event)"
> height="30" width="51" id="Btn_Down"/>
>
> <mx:Script>
>   <![CDATA[
>         import com.google.maps.LatLng;
>     import com.google.maps.Map;
>         import com.google.maps.LatLngBounds;
>         import com.google.maps.MapOptions;
>         import com.google.maps.MapType;
>         import com.google.maps.MapMouseEvent;
>
>         private function onMapReady(event:Event):void
>         {
>             this.map.setCenter(new LatLng(37.560327,126.950185), 13,
> MapType.HYBRID_MAP_TYPE);
>                         var myMapOptions:MapOptions = new MapOptions();
>                         myMapOptions.zoom = 13;
>                         myMapOptions.center = new 
> LatLng(37.560327,126.950185);
>                         myMapOptions.mapType = MapType.HYBRID_MAP_TYPE;
>                         this.map.setInitOptions(myMapOptions);
>                         this.map.enableScrollWheelZoom();
>                         this.map.addEventListener(MapMouseEvent.MOUSE_UP, 
> onMapMouseUp);
>                         this.map.addEventListener(MapMouseEvent.MOUSE_DOWN,
> onMapMouseDown);
>         }
>
>        private var MouseDownPoint : Point;
>            private var MouseUpPoint : Point;
>
>        private function onMapMouseDown(event:Event):void{
>            OnMapMove(0,0,0);
>            MouseDownPoint = new Point(map.contentMouseX,
> map.contentMouseY);
>        }
>
>        private function onMapMouseUp(event:Event):void{
>            MouseUpPoint = new Point(map.contentMouseX,
> map.contentMouseY);
>
>            if (MouseUpPoint.toString() != MouseDownPoint.toString()) {
>               var PointAngle : Number = GetAngle(MouseDownPoint,
> MouseUpPoint);
>               var Diff_X : Number = 1000* (1-(3/(map.width /
> Math.abs(MouseUpPoint.x - MouseDownPoint.x))));
>               var Diff_Y : Number = 1000* (1-(3/(map.height /
> Math.abs(MouseUpPoint.y - MouseDownPoint.y))));
>
>               var ScaleMoveLat : Number;
>               var PointAngleSin : Number = Math.sin(PointAngle);
>               if (PointAngleSin == 0) ScaleMoveLat = 0;
>               else ScaleMoveLat = Diff_Y / PointAngleSin;
>
>               var ScaleMoveLng : Number;
>               var PointAngleCos : Number = Math.cos(PointAngle);
>               if (PointAngleCos == 0) ScaleMoveLng = 0;
>               else ScaleMoveLng = -Diff_X / PointAngleCos;
>
>               OnMapMove(0, ScaleMoveLat, ScaleMoveLng);
>            }
>        }
>
>        private function GetAngle( p1:Point, p2:Point):Number
> { //-1~0~1
>            var dx:Number = p2.x - p1.x;
>            var dy:Number = p2.y - p1.y;
>            if (dx == 0){
>               if (dy == 0 ) return 0;
>               else if (dy < 0 ) return -Math.PI/2;
>               else return Math.PI/2;
>            } else if (dy == 0){
>               if (dx >= 0 ) return 0;
>               else return Math.PI;
>            } else {
>              return Math.atan2( dy, dx );
>            }
>        }
>         private function OnBtnMapMove(event:Event):void{
>                 OnMapMove(0,0,0);
>                 var ScaleMoveLat : Number = 0;
>             var ScaleMoveLng : Number = 0;
>                 if(event.target == Btn_UP){
>                         ScaleMoveLat = 500;
>                         ScaleMoveLng = 0;
>                 }else if(event.target == Btn_Down){
>                         ScaleMoveLat = -500;
>                         ScaleMoveLng = 0;
>                 }else if(event.target == Btn_Left){
>                         ScaleMoveLat = 0;
>                         ScaleMoveLng = -500;
>                 }else if(event.target == Btn_Right){
>                         ScaleMoveLat = 0;
>                         ScaleMoveLng = 500;
>                 }
>                 OnMapMove(0, ScaleMoveLat, ScaleMoveLng);
>         }
>         private function OnBtnSTOP() : void {
>                 OnMapMove(0,0,0);
>         }
>         private function OnBtnMapMove2(event:Event):void{
>                 OnMapMove(0,0,0);
>                 var ScaleMoveLat : Number = 0;
>             var ScaleMoveLng : Number = 0;
>                 if(event.target == Btn_UP0){
>                         ScaleMoveLat = 500;
>                         ScaleMoveLng = 0;
>                 }else if(event.target == Btn_Down0){
>                         ScaleMoveLat = -500;
>                         ScaleMoveLng = 0;
>                 }else if(event.target == Btn_Left0){
>                         ScaleMoveLat = 0;
>                         ScaleMoveLng = -500;
>                 }else if(event.target == Btn_Right0){
>                         ScaleMoveLat = 0;
>                         ScaleMoveLng = 500;
>                 }
>                 OnMapMove(50, ScaleMoveLat, ScaleMoveLng);
>         }
>         private var currentTimer:Timer = new Timer(10, 50);
>         private var MoveLat : Number = 0;
>         private var MoveLng : Number = 0;
>
>         private function OnMapMove(TimerRepeatCount : Number,
> MoveScaleLat : Number, MoveScaleLng : Number):void{
>           currentTimer.stop();
>           currentTimer.removeEventListener(TimerEvent.TIMER,
> OnMapMoveTIMER);
>           currentTimer.repeatCount = TimerRepeatCount;
>           currentTimer.reset();
>
>           var MapLatLngBound : LatLngBounds = map.getLatLngBounds();
>           if (MoveScaleLat == 0) MoveLat = 0;
>           else MoveLat = (MapLatLngBound.getNorth()-
> MapLatLngBound.getSouth()) / MoveScaleLat;
>           if (MoveScaleLng == 0) MoveLng = 0;
>           else MoveLng = (MapLatLngBound.getEast()-
> MapLatLngBound.getWest()) / MoveScaleLng;
>
>           currentTimer.addEventListener(TimerEvent.TIMER,
> OnMapMoveTIMER);
>           currentTimer.start();
>         }
>
>         public function OnMapMoveTIMER(event:TimerEvent) :void
>         {
>                         var CLatLng : LatLng = new 
> LatLng(map.getCenter().lat()+MoveLat,
> map.getCenter().lng()+MoveLng);
>                         map.setCenter(CLatLng);
>         }
>   ]]>
> </mx:Script>
>
> </mx:Application>
> ///////////////////////////////////////////////////////////////////////////-///////////////////////////////////////////////////////////////////////////-/
>
> ■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
> 카페 :http://cafe.naver.com/gisapplication
> 싸이월드:http://www.cyworld.com/srhong007
> ■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□

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