Is there any way to use non-embedded images as marker icons? I've seen it in the JS API. I'd like to pass in an image from a URL because my marker icons are determined at run-time.
On Aug 26, 12:22 am, "pamela (Google Employee)" <[email protected]> wrote: > Hi Antonis- > > What if you do { icon: new customMarker() } ? > > Generally, if the defaultmarkeris displayed, that means the API > doesn't understand what you passed into icon. > > - pamela > > On Mon, Aug 24, 2009 at 6:51 PM, antonis<[email protected]> > wrote: > > > Hi Pamela and thank you for your response! > > > Unfortunately it did not work though. As i mentioned i am developing > > in Adobe Flash CS3 Professional and i have imported my custommarker > > in the library so i supposed it already was embeded in my swf. Anyway > > since you told me i had to embed it and after going through the code > > you suggested i added > > > [Embed(source="/arrow.png")] var customMarker:Class; > > var customIcons:Object = > > {"myMarker": customMarker}; > > > And then assign > > > icon : customIcons["myMarker"] > > > in MarkerOptions, but the API "ignore" the custom icon and instead > > show the defaultmarker. I do not get any errors though, just the > > defaultmarkerinstead of the one i want! > > > Thank you for your time, > > Antonis > > > On Aug 24, 4:51 am, "pamela (Google Employee)" <[email protected]> > > wrote: > >> Hi Antonis- > > >> You need to embed thatimage, you can't just pass in a string. This > >> example shows how to do > >> that:http://gmaps-samples-flash.googlecode.com/svn/trunk/demos/XmlParsingD... > > >> You can right click to view the source on that. > > >> - pamela > > >> On Sat, Aug 22, 2009 at 3:50 AM, antonis<[email protected]> > >> wrote: > > >> > Hi, > > >> > I am new in programming on google maps and i would really appreciate > >> > your help! > > >> > I have been trying to add a custommarkeron 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 DragableMarker > >> > //Put themarkersomwhere 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); > > >> > varmarker:Marker= newMarker(latlng, new MarkerOptions({ > > >> > draggable: true, > >> > tooltip: "Drag thismarker", > >> > 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 -~----------~----~----~----~------~----~------~--~---
