Hi, i have some Problems with my code.
i want to change the textFormat in the infowindow.
I hope you can help me.
sorry for my enlish.
here is the code
thx rob
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.ZoomControl;
//import com.google.maps.controls.PositionControl;
//import com.google.maps.controls.MapTypeControl;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.overlays.Marker;
import com.google.maps.InfoWindowOptions;
import com.google.maps.MapMouseEvent;
//import flash.text.TextFormat;
// Create The Map
var map:Map = new Map();
map.key = "ABQIAAAAHnTxrW35iwO7TUyb5DVSlRQxwGfbL6iJ0RFbppF_-
QJlM0HZohRurIf7OmFH21CL0s2xiRXkLddrmA";
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
mapcontainer.addChild(map);
function onMapReady(event:MapEvent):void {
map.setCenter(new LatLng(52.507407,13.220243), 11,
MapType.HYBRID_MAP_TYPE);
map.addControl(new ZoomControl());
// map.addControl(new PositionControl());
// map.addControl(new MapTypeControl());
xmlLoader();
}
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].lon);
var tip = map_xml.location[i].name_tip;
var myTitle:String = map_xml.location[i].title_tip;
var myContent:String = map_xml.location[i].content_tip;
map.addOverlay(createMarker(latlng,i, tip, myTitle,
myContent));
}// end of for loop
// Add Markers On The Map
function createMarker(latlng:LatLng, number:Number, tip, myTitle,
myContent):Marker {
var i:Marker = new Marker(
latlng,
new MarkerOptions({
icon: new MeinMarker(),
hasShadow:
true,
tooltip: ""+tip
})
);
i.addEventListener(MapMouseEvent.CLICK, function
(event:MapMouseEvent):void
{
map.openInfoWindow(event.latLng, new InfoWindowOptions
({
titleHTML: ""+myTitle,
contentHTML: ""+myContent
}));
});
return i;
}// end function createMarker
}// end of loadXML function
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
xmlLoader.load(new URLRequest("xml.xml"));
}
On 13 Jul., 06:57, "pamela (Google Employee)" <[email protected]>
wrote:
> That sounds like a function closure problem. Read through this section of
> the developer's guide and note how the example does
> it:http://code.google.com/apis/maps/documentation/flash/events.html#Even...
>
> <http://code.google.com/apis/maps/documentation/flash/events.html#Even...>-
> pamela
>
> On Mon, Jul 13, 2009 at 2:49 PM, help(question) <[email protected]>wrote:
>
>
>
> > Hello, and thank you to everyone.
>
> > I need to make a map that read XML. I need it to create multiple
> > markers and each marker needs to have separate, unique information
> > associated with it. For example address[1] - info[1]; address[2] - info
> > [2]; address[3] - info[3].
>
> > I have gotten as far creating the map with multiple markers but the
> > all the info windows get populated with the last bit of info. For
> > example, address[1] has info[3].
>
> > Thank you again.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---