I think my answer is detailed enough. You can send your file over, and i will make the changes for you.
On Mon, Jul 13, 2009 at 5:27 PM, Ruben Braun <[email protected]> wrote: > > hi, > > thx, for the quick answer, > but i can`t follow you. > can give me a more detailed answer. > > rob > > -------- Original-Nachricht -------- > > Datum: Mon, 13 Jul 2009 17:13:38 +0800 > > Von: Juguang XIAO <[email protected]> > > An: [email protected] > > Betreff: Re: Adding markers with infoWindows > > > It looks like function closure problem. > > > > You can try to bring your CLICK event handler to class level by making it > > a > > class method. Then also have a marker-data mapping at class level, so > > that > > when CLICK event handler is triggered, get which marker is involved by > > event.target , and map the marker to its data, then render your text. > > > > (1) var marker_data:Array = []; // as class variable > > > > (2) when a marker is added, also do this. > > > > marker_data.push([marker, marker_data]); > > > > (3) in CLICK event handler > > > > function onClick(event:MouseEvent):void{ > > var marker:Marker = event.target as Marker; > > // iterate marker_data to find the right one > > for each(var pair:Array in marker_data){ > > if(pair[0] == marker){ > > pair[1]; // this is the related data > > // do what you like > > } > > } > > > > (4) register your marker's CLICK event with its handler > > > > > > > > Hope that help. > > > > > > > > > > > > > > On Mon, Jul 13, 2009 at 4:59 PM, rob <[email protected]> wrote: > > > > > > > > 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. > > > > > > > > > > > > > -- > > ============= > > Juguang XIAO > > Beijing, China > > > > > > > -- > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 > > > > -- ============= Juguang XIAO Beijing, China --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
