Hi,

I am new in programming on google maps and i would really appreciate
your help!

I have been trying to add a custom marker on my map but have not
managed to do it. Have searched around a lot on forums and other sites
but with no luck.

I develop in Flash CS3 and i try to use a file called arrow.png which
is in the same folder as my application and want to position it
somewhere close to the bottom right corner of my map. To be sure that
i use a correct png file i downloaded one that purpose for this. It is
a 39 x 34, 757bytes .png icon.

I attach my code below.

Thank you very much in advance. I will be looking forward to some
assistance.



//----- MY CODE -------------

import com.google.maps.LatLng;
import com.google.maps.LatLngBounds;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.MapOptions;
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.MapMouseEvent;


var map:Map = new Map();
map.setSize(new Point(650, 750));
map.x = 100;
map.y = 0;
map.addEventListener(MapEvent.MAP_READY, onMapReady);
map.addEventListener(MapEvent.MAP_PREINITIALIZE, onMapPreinitialize);
this.addChild(map);

function onMapPreinitialize(event:Event):void {
          var myMapOptions:MapOptions = new MapOptions();


                  myMapOptions.zoom = 15;
          myMapOptions.center = new LatLng(37.971473, 23.726701);
          myMapOptions.mapType = MapType.NORMAL_MAP_TYPE;
          this.map.setInitOptions(myMapOptions);
        }



function onMapReady(event:Event):void {


//Add Dragable Marker
         //Put the marker somwhere close to the bottom right corner
         var bounds:LatLngBounds = map.getLatLngBounds();
         var southWest:LatLng = bounds.getSouthWest();
         var northEast:LatLng = bounds.getNorthEast();
         var lngSpan:Number = northEast.lng() - southWest.lng();
         var latSpan:Number = northEast.lat() - southWest.lat();

         latlng = new LatLng(southWest.lat()+latSpan/20,northEast.lng()-
lngSpan/10);


        var marker:Marker = new Marker(latlng, new MarkerOptions({

                                  draggable: true,
                                  tooltip: "Drag this marker",
                          icon : "arrow.png"
                          }));


  map.addOverlay(marker);
  trace(marker.getLatLng());

        marker.addEventListener(MapMouseEvent.DRAG_START, function
(event:Event):void {
trace(marker.getLatLng());
  });
    marker.addEventListener(MapMouseEvent.DRAG_END, function
(event:Event):void {
trace(marker.getLatLng());
  });

}

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