Hi Duncan,

Thanks for the heads up had a look around and am still stuck do you
have any example code or could you point me in the right direction?

this is the part of the code that references the mc and the
definitions(sorry for the original large code block):

// custom icons
var house_icon:house_mc = new house_mc();// <--mc in my library
var bungalow_icon:bungalow_mc = new bungalow_mc();// <--mc in my
library

// set custom icons from movie clips in library
var customIcons:Object = {
        "House": house_icon,
        "Bungalow": bungalow_icon
}
----------------------------------------------------------------------------

// reference part to mc in code
new MarkerOptions({
                              icon: customIcons[type],


Sorry to bother you and thanks for your help already.



On May 25, 6:42 pm, Duncan Hall <[email protected]> wrote:
> Difficult to tell with that mammoth code block viewed on an iPhone,  
> but the most likely cause is using a single instance of a  
> DisplayObject for mutiple markers. To use a custom icon for a marker,  
> you must create a new instance of that icon, rather than passing  
> multiple references to the same instance.
>
> Sent from my iPhone
>
> On 25 May 2010, at 09:28, "[email protected]" <[email protected]
>
>
>
>
>
>  > wrote:
> > Hi all had a search around but can't find any help so far, so i hope
> > someone can help me out.
> > I have created the map and populated it with xml markers which is no
> > problems but now I want the markers to have icons based on their type
> > from the xml. I've got so far with the code below but the
> > "customIcons" only get added to a couple of the markers on the map the
> > rest are standard orange google markers or disappear. The markers I am
> > using are mc's in my library and defined in the code.
>
> > Thanks in advanced for any help.
>
> > My AS3 Code:
>
> > // import classes
> > import com.google.maps.LatLng;
> > import com.google.maps.Map;
> > import com.google.maps.MapEvent;
> > import com.google.maps.MapType;
> > import com.google.maps.controls.NavigationControl;
> > import com.google.maps.controls.MapTypeControl;
> > import com.google.maps.controls.OverviewMapControl;
> > import com.google.maps.overlays.MarkerOptions;
> > import com.google.maps.overlays.Marker;
> > import com.google.maps.InfoWindowOptions;
> > import com.google.maps.MapMouseEvent;
>
> > // custom icons
> > var house_icon:house_mc = new house_mc();// <--mc in my library
> > var bungalow_icon:bungalow_mc = new bungalow_mc();// <--mc in my
> > library
>
> > // set custom icons from movie clips in library
> > var customIcons:Object = {
> >    "House": house_icon,
> >    "Bungalow": bungalow_icon
> > }
> > // create The Map
> > var map:Map = new Map();
> > map.key = "*****************************************************";
> > map.setSize(new Point(stage.stageWidth, stage.stageHeight));
> > map.addEventListener(MapEvent.MAP_READY, onMapReady);
> > this.addChild(map);
>
> > //map ready function
> > function onMapReady(event:MapEvent):void {
> >  map.setCenter(new LatLng(50.161175, -5.088215), 13,
> > MapType.HYBRID_MAP_TYPE);
> >  map.addControl(new NavigationControl());
> >  map.addControl(new OverviewMapControl());
> >  map.addControl(new MapTypeControl());
> >  xmlLoader();
> > }
> > // load xml and loop through
> > function xmlLoader(){
> > function loadXML(e:Event):void{
> >     XML.ignoreWhitespace = true;
> >     var map_xml:XML = new XML(e.target.data);
>
> >     for (var i:Number = 0; i < map_xml.location.length(); i++){
>
> >         var latlng:LatLng = new LatLng(map_xml.location[i].lat,
> > map_xml.location[i].lng);
> >         var name = map_xml.location[i].name;
> >         var address:String = map_xml.location[i].address;
> >         var vis:String = map_xml.location[i].vis;
> >         var beds:String = map_xml.location[i].beds;
> >         var type:String = map_xml.location[i].type;
> >         var photo1:String = map_xml.location[i].photo1;
> >         var id:String = map_xml.location[i].id;
> >         var conad:String = name+" "+address;
> >         //trace(conad);
>
> >         map.addOverlay(createMarker(latlng,i, name, address, conad,  
> > photo1,
> > type));
>
> >     }// end of for loop
>
> >     // add markers
> >     function createMarker(latlng:LatLng, number:Number, name, address,
> > conad, photo1, type):Marker {
> >               var i:Marker = new Marker(
> >                                         latlng,
> >                                         new MarkerOptions({
> >                                                           icon:  
> > customIcons[type],// <--icon by type from
> > customIcons Object above
> >                                                           hasShadow:
> > false,
> >                                                           tooltip:  
> > ""+type
> >                                                           })
> >                                         );
> >               i.addEventListener(MapMouseEvent.CLICK,
> > function(event:MapMouseEvent):void
>
> >                                                                     {
>
> > map.openInfoWindow(event.latLng, new
> > InfoWindowOptions({
>
> > titleHTML: "<b>"+conad+"</b>",
>
> > contentHTML: ""+photo1
>
> >                                                                   }));
>
> >                                                                  });
> >               return i;
> >      }// end function createMarker
> > }// end of loadXML function
>
> > //  define xml file
> > var xmlLoader:URLLoader = new URLLoader();
> > xmlLoader.addEventListener(Event.COMPLETE, loadXML);
> > xmlLoader.load(new URLRequest("mapxml.xml"));
> > }
>
> > --
> > 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 
> > athttp://groups.google.com/group/google-maps-api-for-flash?hl=en
> > .
>
> --
> 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 
> athttp://groups.google.com/group/google-maps-api-for-flash?hl=en.

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