Look, you have you markers layers on the map, right? you marker must have an ID
when you make a call to the server, it`ll result some data... you have to compare this data with your marker layer then you can update its position you can do this comparison with for each () Best regards, Thiago 2011/8/3 mose <david.mosem...@gmail.com> > Hello, > > I'm working on a project that streams a data file located on a server and > dynamically updates the marker position based on the new variable. I have a > URLLoader set up on a ENTER_FRAME listener to constantly load the data file. > Theoretically this would update the values for the variable and update the > marker position on the map. I've gone through several iterations and feel > I'm close but keep getting an error in the output. > > This is the code (AS3 in Flash CS3), data file attached > > import com.google.maps.LatLng; > import com.google.maps.Map; > import com.google.maps.MapEvent; > import com.google.maps.MapType; > import com.google.maps.MapOptions; > import com.google.maps.overlays.Marker; > import com.google.maps.overlays.MarkerOptions; > import com.google.maps.MapType; > import com.google.maps.LatLng; > import com.google.maps.styles.FillStyle; > import com.google.maps.styles.StrokeStyle; > > var map:Map = new Map(); > map.key = > "ABQIAAAAHd1oWFmQAluhsudaMyXOWhSMrb4kdAOmjCYToXTfcs9lB0vBYRQfOrZCZrtlSuT0A4kadCG08XPoEg"; > map.sensor = "false"; > map.setSize(new Point(stage.stageWidth, stage.stageHeight)); > map.addEventListener(MapEvent.MAP_PREINITIALIZE, onMapPreinitialize); > this.addChild(map); > > function onMapPreinitialize(event:Event):void { > > var myMapOptions:MapOptions = new MapOptions(); > myMapOptions.zoom = 12; > myMapOptions.center = new LatLng(40.76629106797523,-77.87853651876857); > myMapOptions.mapType = MapType.PHYSICAL_MAP_TYPE; > this.map.setInitOptions(myMapOptions); > } > > map.addEventListener(MapEvent.MAP_READY, onMapReady); > > function onMapReady(event:Event):void { > var vehicleOptions:MarkerOptions = new MarkerOptions({ > strokeStyle: { > color: 0x00FF00, > thickness: 2 > }, > fillStyle: { > color: 0x597D12 > }, > label: "test", > labelFormat: { > font: "Verdana", > size: 10, > bold: true, > color: 0x000000 > } > }); > var vehicle:Marker = new Marker(map.getCenter(), vehicleOptions); > map.addOverlay(vehicle); > } > > addEventListener(Event.ENTER_FRAME, getData, false, 0, true); > > function getData(evt:Event):void { > var dataLdr:URLLoader = new URLLoader(); > dataLdr.dataFormat = URLLoaderDataFormat.VARIABLES; > dataLdr.load(new URLRequest("data.txt")); > > dataLdr.addEventListener(Event.COMPLETE, onComplete, false, 0, true); > > function onComplete(evt:Event):void { > evt.target.removeEventListener(Event.COMPLETE, onComplete); > var lat:Number = evt.target.data.latitude; > var lng:Number = evt.target.data.longitude; > var vehicleLocation:LatLng = new LatLng(lat,lng); > vehicle.setLatLng(vehicleLocation); > } > } > > I've only been working with CS3 for a few months now, so it's quite > possible I'm missing something obvious. > Any insight would be greatly appreciated. > > Thanks, > mose > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps API For Flash" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-maps-api-for-flash/-/UfLI0tWrHyAJ. > To post to this group, send email to > google-maps-api-for-flash@googlegroups.com. > To unsubscribe from this group, send email to > google-maps-api-for-flash+unsubscr...@googlegroups.com. > For more options, visit this group at > http://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 google-maps-api-for-flash@googlegroups.com. To unsubscribe from this group, send email to google-maps-api-for-flash+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-api-for-flash?hl=en.