HI , can you give me the code for custom pan control and zoom control in javascript.
Thanks in advance. Madhavi. On Saturday, 19 July 2008 15:50:52 UTC+5:30, Arthurnasius Amanyire wrote: > > thanks a lot pamela, you are great. it worked just as i wanted. i just > changed a few staff. thanks again. > > On Sat, Jul 19, 2008 at 9:44 AM, pamela (Google Employee) < > pame...@gmail.com <javascript:>> wrote: > >> >> Hi- >> >> I've created a custom pan control example here: >> >> http://gmaps-samples-flash.googlecode.com/svn/trunk/demos/PanControlDemo/PanControlDemo.html >> >> It uses panBy to pan a certain distance (in pixels) on each press of >> the buttons, and is very similar to PositionControl. >> Hope that helps. >> >> - pamela >> >> On Fri, Jul 18, 2008 at 1:10 AM, Arthurnasius Amanyire >> <stin...@gmail.com <javascript:>> wrote: >> > is there a way to do this in flex. here is the code for my custom pan >> > controls >> > >> > var mySprite1:Sprite = new Sprite(); >> > mySprite1.x = 30; >> > mySprite1.y = 25; >> > >> > var navigator:Shape = new Shape(); >> > navigator.graphics.beginFill(0*000000); >> > navigator.graphics.drawCircle(6, -50, 40); >> > navigator.alpha = .5; >> > >> > var middleholder:Sprite = new Sprite(); >> > middleholder.graphics.beginFill(0*000000); >> > middleholder.graphics.drawCircle(6, -50, 10); >> > middleholder.alpha = 1; >> > var middle:Loader = new Loader; >> > middle.x = 1.25; >> > middle.y = -54.6; >> > var middle_url:URLRequest = new URLRequest("../middle.png"); >> > middle.load(middle_url); >> > addChild(middle) >> > middle.contentLoaderInfo.addEventListener(Event.COMPLETE, >> > function(evt:Event):void >> > { >> > middle.content; >> > }); >> > middleholder.addChild(middle); >> > >> > var northholder:Sprite = new Sprite(); >> > northholder.graphics.beginFill(0*000000); >> > northholder.graphics.drawCircle(6, -75, 10); >> > northholder.alpha = 1; >> > var north:Loader = new Loader; >> > north.x = 1.25; >> > north.y = -80.6; >> > var north_url:URLRequest = new >> URLRequest("../north_triangle.png"); >> > north.load(north_url); >> > north.contentLoaderInfo.addEventListener(Event.COMPLETE, >> > function(evt:Event):void >> > { >> > north.content; >> > }); >> > northholder.addChild(north); >> > >> > var southholder:Sprite = new Sprite(); >> > southholder.graphics.beginFill(0*000000); >> > southholder.graphics.drawCircle(6, -25, 10); >> > southholder.alpha = 1; >> > var south:Loader = new Loader; >> > south.x = 1.25; >> > south.y = -28.6; >> > var south_url:URLRequest = new >> URLRequest("../south_triangle.png"); >> > south.load(south_url); >> > south.contentLoaderInfo.addEventListener(Event.COMPLETE, >> > function(evt:Event):void >> > { >> > south.content; >> > }); >> > southholder.addChild(south); >> > >> > var eastholder:Sprite = new Sprite(); >> > eastholder.graphics.beginFill(0*000000); >> > eastholder.graphics.drawCircle(32, -50, 10); >> > eastholder.alpha = 1; >> > var east:Loader = new Loader; >> > east.x = 29.25; >> > east.y = -55.6; >> > var east_url:URLRequest = new >> URLRequest("../east_triangle.png"); >> > east.load(east_url); >> > east.contentLoaderInfo.addEventListener(Event.COMPLETE, >> > function(evt:Event):void >> > { >> > east.content; >> > }); >> > eastholder.addChild(east); >> > >> > var westholder:Sprite = new Sprite(); >> > westholder.graphics.beginFill(0*000000); >> > westholder.graphics.drawCircle(-20, -50, 10); >> > westholder.alpha = 1; >> > var west:Loader = new Loader; >> > west.x = -26.75; >> > west.y = -55.6; >> > var west_url:URLRequest = new >> URLRequest("../west_triangle.png"); >> > west.load(west_url); >> > west.contentLoaderInfo.addEventListener(Event.COMPLETE, >> > function(evt:Event):void >> > { >> > west.content; >> > }); >> > westholder.addChild(west); >> > >> > mySprite1.addChild(middleholder); >> > mySprite1.addChild(northholder); >> > mySprite1.addChild(southholder); >> > mySprite1.addChild(eastholder); >> > mySprite1.addChild(westholder); >> > mySprite1.addChild(navigator); >> > this.addChild(mySprite1); >> > >> > On Thu, Jul 17, 2008 at 8:15 PM, gajok <ky...@free.fr <javascript:>> >> wrote: >> >> >> >> for Flash, >> >> Here "googleMap" is instance name of the map : >> >> >> >> //// custom controls btn : >> >> move_up_btn.addEventListener(MouseEvent.CLICK, moveup); >> >> function moveup (e:Event) { >> >> googleMap.panBy(new Point (0,-100)); // (x,y) >> >> } >> >> move_down_btn.addEventListener(MouseEvent.CLICK, movedown); >> >> function movedown (e:Event) { >> >> googleMap.panBy(new Point (0,100)); // (x,y) >> >> } >> >> move_left_btn.addEventListener(MouseEvent.CLICK, moveleft); >> >> function moveleft (e:Event) { >> >> googleMap.panBy(new Point (-100,0)); // (x,y) >> >> } >> >> move_right_btn.addEventListener(MouseEvent.CLICK, moveright); >> >> function moveright (e:Event) { >> >> googleMap.panBy(new Point (100,0)); // (x,y) >> >> } >> >> move_center_btn.addEventListener(MouseEvent.CLICK, movecenter); >> >> function movecenter (e:Event) { >> >> googleMap.setCenter(googleMap.getCenter()); // NOT WORKS >> >> } >> >> zoom_in_btn.addEventListener(MouseEvent.CLICK, zoomin); >> >> function zoomin (e:Event) { >> >> googleMap.setZoom(googleMap.getZoom()+1); // (level:Number) >> >> } >> >> zoom_out_btn.addEventListener(MouseEvent.CLICK, zoomout); >> >> function zoomout (e:Event) { >> >> googleMap.setZoom(googleMap.getZoom()-1); // (level:Number) >> >> } >> >> >> >> Hi Pamela, >> >> why my "back to center" btn not works ?? >> >> at start i have : googleMap.setCenter(new LatLng....etc ); >> >> >> >> Thanks >> >> >> > >> > >> > > >> > >> >> >> > -- You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-api-for-flash+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-api-for-flash@googlegroups.com. Visit this group at http://groups.google.com/group/google-maps-api-for-flash?hl=en. For more options, visit https://groups.google.com/groups/opt_out.