Sign in to follow this  
FusionCharts Support

XML external call FusionChart in a Flash Movie

Recommended Posts

I purchased Flash Charts Developer. I'm using the MultipleCharts from the Code FlashExamples. I'm using Bar2D and Pie3D charts.

I've looked at your FlashExamples in the code library for Fusioncharts_Developer. It was very helpful starting out, Thank you.

What I'm looking for is the code in the Action Script to fetch data out of a XML file. The code examples that came with the product all have the XML data as part of the Action Script. I have users updating a XML file and I don't want them to have to edit in Flash to update the data. Can you assist?

Thanks!

Share this post


Link to post
Share on other sites

Hi,

can you please try this?

// ------------- Load XML Data for the chart -------------- //

var xmlData:XML = new XML();

//Delegate the onLoad event of XML to our custom createChart function

xmlData.onLoad = createChart;

xmlData.load("MyData.xml");

//createChart method is called when XML has loaded

function createChart(success){

if (success){

  //Create the container movie clip. Note the use of _root here, as we're still

  //in scope of XML object. To come out of that, you may use Delegate class.

  var chartContainerMC:MovieClip = _root.createEmptyMovieClip("ChartHolder",1);

  //Now, instantiate the chart using Constructor function of the chart.

  var myFirstChart:Column3D = new Column3D(chartContainerMC, 1, 450, 220, 20, 15, false, false, "", "EN", "noScale");

  //Convey the XML data object to chart.

  myFirstChart.setXMLData(xmlData);

  //Draw the chart

  myFirstChart.render();

}else{

  trace("Error in loading data");

  }

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