You're asynchronously loading the image in - so you can't use the icon until after the Event.COMPLETE callback. You'll need to call .setOptions in the callback, or create your marker there - your choice.
- pamela On Wed, Apr 1, 2009 at 10:33 AM, Amit Pal <[email protected]> wrote: > Hi Pamela, > > I am trying to do the following in KML Parser example but it doesn't seem > to work. I couldn't see the image in place of default marker. If I try to do > the way it is there in your example then it works.Is there any difference in > both these ways of setting options? : > > Moreover, I want to change the color of the image also( fill it with > different color), like we can do with the default marker. Is this possible? > > * var options:MarkerOptions = new > MarkerOptions();** > options.tooltip = placemark.name; > > var markerStyle:Style = mapStyle(styleUrl); > > var icon_href:String = > markerStyle.iconStyle.icon.href; > trace("***icon_href:"+ icon_href); > > var request:URLRequest; > request = new URLRequest(icon_href); > var image2Loader:Loader = new Loader(); > > image2Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, > function(event:Event):void { > options.icon = > image2Loader;}); > image2Loader.load(request); > > //Setting fill style for icon > var fillStyle:FillStyle = new FillStyle(); > var colObj:Object = new Object(); > colObj = markerStyle.iconStyle.color; > > fillStyle.color = int(colObj); > options.fillStyle = fillStyle; > > obj.mapObject = new Marker(latlng,options); > > > obj.mapObject.addEventListener(MapMouseEvent.CLICK, > function(e:MapMouseEvent):void { > > obj.mapObject.openInfoWindow(windowOptions);}); > > //Also tried this > //obj.mapObject.setOptions(options);* > > Thanks, > Amit > > > On Tue, Mar 31, 2009 at 3:47 PM, Amit Pal <[email protected]> wrote: > >> Cool, that works for me. >> >> Thanks, >> Amit >> >> >> On Tue, Mar 31, 2009 at 1:08 PM, pamela fox <[email protected]> wrote: >> >>> You should be able to load any image, but the shadow will only work for >>> images on a server with a permissible crossdomain.xml. >>> - pamela >>> >>> >>> On Wed, Apr 1, 2009 at 3:40 AM, Amit Pal <[email protected]>wrote: >>> >>>> This is almost equivalent to embedding an image from local file system. >>>> >>>> Is there any workaround so that I can use image from any URL? >>>> >>>> Thanks, >>>> Amit >>>> >>>> >>>> On Tue, Mar 31, 2009 at 7:36 AM, [email protected] < >>>> [email protected]> wrote: >>>> >>>>> >>>>> one note amit - because of the security sandbox - you cannot load >>>>> images cross-domains. >>>>> You would need to have that image located on the same server as your >>>>> base flash file. >>>>> >>>>> On Mar 30, 3:17 pm, Amit Pal <[email protected]> wrote: >>>>> > Just to add, I am trying to use a URL for the icon(e.g., >>>>> http://maps.google.com/mapfiles/kml/pal3/icon21.png). >>>>> > >>>>> > -Amit >>>>> > >>>>> > On Mon, Mar 30, 2009 at 11:44 AM, Amit Pal <[email protected]> >>>>> wrote: >>>>> > > Hi Pamela, >>>>> > >>>>> > > How can I use a flash DisplayObject to set 'icon' property using >>>>> > > Marker.setOptions. Is there any example ? >>>>> > >>>>> > > Thanks, >>>>> > > Amit >>>>> > >>>>> > > On Sun, Mar 29, 2009 at 7:53 PM, pamela fox <[email protected]> >>>>> wrote: >>>>> > >>>>> > >> Hi Amit- >>>>> > >> You can use Marker.setOptions, and just change the icon property: >>>>> > >>>>> > >> >>>>> http://code.google.com/apis/maps/documentation/flash/reference.html#M. >>>>> .. >>>>> > >>>>> > >> - pamela >>>>> > >>>>> > >> On Sat, Mar 28, 2009 at 2:43 AM, Amit Pal < >>>>> [email protected]>wrote: >>>>> > >>>>> > >>> Hi, >>>>> > >>>>> > >>> My use case is to use custom icons as markers using KML. >>>>> > >>> Is it possible to change the color of these custom icons like we >>>>> do with >>>>> > >>> default Google map markers. >>>>> > >>>>> > >>> Thanks, >>>>> > >>> Amit >>>>> > >>>>> > >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
