Hi everybody, so my first post here, I didnt find a solutions that
fits my problem (only to rewrite everything), so I am new to Flex as
many and also first time I use Google Map with it.

So first of all I have a few Flex buttons on the bottom and when I
click on the first which is called "Home" I get XML out of a php
script (connects to database, rewrites everything in fine XML data).

So here is the code:

First I read out the XML from PHP by giving the PHP-Script a value so
that it knows what button is clicked to get the correct data.

Then later in readXML i create Markers for each XML entry (in the
first case "home" its just one entry of course)

I create the markers and also want to set a MarkerOption so that every
marker has it.
The problem is that something like marker_options.hasShadow = false;
works but the custom icons doesnt work! The marker just dont come up/
the icon wont be displayed on the map.

public function getXml(whatMarker:String):void
                {
                        var xmlString:URLRequest = new 
URLRequest("get_marker.php?
whatMarker=" + whatMarker + "");
                        var xmlLoader:URLLoader = new URLLoader(xmlString);
                        xmlLoader.addEventListener("complete", readXml);
                }

                public function readXml(event:Event):void
                {
                var markersXML:XML = new XML(event.target.data);
                var markers:XMLList = markersXML.marker;


                        for (var i:Number = 0; i < markers.length(); i++)
                        {
                                 var marker:XML = markers[i];
                                 var latlng:LatLng = new LatLng(mark...@lat, 
mark...@lng);


                        map.addOverlay(createMarker(latlng));
                        }
                }

        public function createMarker(latlng:LatLng): Marker
                {
                        var marker:Marker = new Marker(latlng);
                        marker.setOptions(setMarkerOptions(marker));

                        return marker;
                }

                public function setMarkerOptions(marker:Marker):MarkerOptions
                {
                        var marker_options:MarkerOptions = new MarkerOptions();
                        marker_options.hasShadow = false;
                        //marker_options.icon = this.icon_home;
                        return marker_options;
                }

The string var called whatMarker has the value "home" when I click on
the button home. The custom icons are saved in the same folder as the
swf all in the same style:

home_icon.png

So I want to set the correct icon depending on the clicked button if I
click the button events i want the markers to have the icon:

events_icon.png

and so on...

so in fact I cant get it done to use something like

marker_options.icon = whatMarker + "_icon.png";

I also tried to create an flex Image for each marker and assign it to
the marker_options.icon but that also didnt work...I really dont know
any way to get it done!

Maybe someone could be so kind and help me out so that I dont have to
rewrite most of the code here, I found many entries about custom
markers but nothing seem to fit my problem. Also trying to find the
problem with given solutions on custom markers had no effect.

So the map is situated in a canvas so thats the code for the map
itself:

<mx:Canvas id="map_canvas" width="1024" height="568">
                <ns1:Map xmlns:maps="com.google.maps.*"
mapevent_mappreinitialize="onMapPreinitialize(event)" id="map"
width="1024" height="568" key="api_key"/>
                <mx:Image source="@Embed('control_zoom_in.png')" id="zoom_in"
x="10" y="10" buttonMode="true" click="mapControl(event, 0)"/>
                <mx:Image source="@Embed('control_zoom_out.png')" id="zoom_out"
x="10" y="50" buttonMode="true" click="mapControl(event, 1)"/>
                </mx:Canvas>

Thank you!!!

Günther



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to