Sign in to follow this  

Custom Map

Recommended Posts

I would like to create a map of our company's district, which includes parts of 4 states. Using the example provided in MyFirstMap.fla, I have created a customized map, but I am still having one issue. I'd like to create a form with radio buttons to change the xml data file source. I have tested this with other maps and charts, and it works correctly, but my custom map is having some issues. My code is below...


I have tested it by adding an 'alert(chartReference.getXMLData());' call at the end of updateMap, and I can see that the xml file is actually updating correctly, but the new data is not updating on the screen. I have tried to add "chartReference.render('chartContainer');" at the end of the updateMap function as well, and the chart does refresh, but only with generic data, not my data file.


Please let me know if you need any more information or if you have any suggestions.






   <title>Update Chart data</title>
  <script LANGUAGE="Javascript" SRC="assets/js/FusionCharts.js"></SCRIPT>
   <div id="chartContainer">FusionCharts will load here!</div>
   <script type="text/javascript"><!--

     var myChart = new FusionCharts( "assets/Charts/OurDistrict.swf", "myChartId", "400", "300", "0", "1" );

	function updateMap(datafile){	
		var chartReference = FusionCharts( "myChartId" );
   // -->

  	  <input name="mapOpt" type="radio" value="OurDistrict_data" onchange="javaScript:updateMap(this.value);" />OurDistrict_data 
     <input name="mapOpt" type="radio" value="OurDistrict_population" onchange="javaScript:updateMap(this.value);" />OurDistrict_population  





#include "com/fusionmaps/includes/"
#include "com/fusionmaps/includes/"

//initialize variables
var stageWidth = 600;
var stageHeight = 450;
var chartX = 0;
var chartY = 0;
var chartDebugMode = false;
var xmlFile = "";
var xmlString = "";

chartWidth = _root.chartWidth;
chartHeight = _root.chartHeight;
if (_root.debugMode == "1"){
chartDebugMode = true;
xmlFile = _root.dataURL;
xmlString = _root.dataXML;

//set chart position
var chartX = (stageWidth - chartWidth)/2;
var chartY = (stageHeight - chartHeight)/2;

// -------------- Actual Code to create the map ------------//
//To create a map, you first need to create an empty movie clip to act as map holder.
var mapContainerMC:MovieClip = this.createEmptyMovieClip("MapHolder", 1);

// ------------- XML Data for the map -------------- //

if (xmlString != ""){
var OurDistrict_Data:XML = new XML(xmlString);
var OurDistrict_Data:XML = new XML();
OurDistrict_Data.ignoreWhite = true;
// --------------------------------------------------- //

OurDistrict_Data.onLoad = function(success) {
if (success) {

function loadMap(){
//Now, instantiate the map using Constructor function of the map.

//Convey the XML data to map.
var myMap:OurDistrictMap = new OurDistrictMap(mapContainerMC, 1, chartWidth, chartHeight, chartX, chartY, chartDebugMode, "EN", "exactFit", false, "");

//Draw the map





Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this