porterfoster Report post Posted July 17, 2009 (edited) Hi. I'm brand new to Fusion Charts, and I'm trying to get MyFirstChart working with an external XML doc, rather than what's hardcoded in Flash. This will be for a standalone desktop application, so it will not be run through a web browser. I got the chart operational as a Multi-Series 3DChart with this hardcoded: var strXML:String = ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; strXML = strXML + ""; //FusionCharts chart classes accept XML data as XML Object //and not XML String. //So, if you've an XML string, first create an XML object from it //and then pass to the chart. We do the same. var xmlData:XML = new XML(strXML); // --------------------------------------------------- // // -------------- Actual Code to create the chart ------------// //To create a chart, you first need to create an empty movie clip to act as chart holder. var chartContainerMC:MovieClip = this.createEmptyMovieClip("ChartHolder",1); //Now, instantiate the chart using Constructor function of the chart. var myFirstChart:MSColumn3DChart = new MSColumn3DChart(mc_chartHolder, 1, 645, 436, 0, 0, false, "EN", "noScale"); //Convey the XML data to chart. myFirstChart.setXMLData(xmlData); //Draw the chart myFirstChart.render(); //Stop stop(); Sorry to bug you guys with something so basic, but I am stuck stuck stuck. So how do I adjust the actionscript to access an external XML? Edited July 17, 2009 by Guest Share this post Link to post Share on other sites
FusionCharts Support Report post Posted July 18, 2009 Hi, Can try with the following code? #include "com/fusioncharts/includes/LoadingFunctions.as" #include "com/fusioncharts/includes/AppMessages.as" import com.fusioncharts.core.charts.Column2DChart; var xmlData:XML = new XML(); xmlData.onload=function(success){ var chartContainerMC:MovieClip = createEmptyMovieClip("ChartHolder",1); var myFirstChart:Column2DChart = new Column2DChart(chartContainerMC, 1, 450, 225, 20, 0, false, "EN", "noScale"); myFirstChart.setXMLData(xmlData); myFirstChart.render(); } xmlData.load("myxmlfile.xml"); stop(); ALGO: 1. import classes required for chart 2. Create XML object 3. use XML.load() to load XML from external file 4. **IMPORTANT** create .onLoad event listner which would be called when the XML is completly loaded 5. Render the chart once the XML is Loaded Share this post Link to post Share on other sites
porterfoster Report post Posted July 21, 2009 thank you so much! That worked perfectly. Share this post Link to post Share on other sites
Guest Rajroop Report post Posted July 21, 2009 Great. Happy FusionCharting. Share this post Link to post Share on other sites