Sign in to follow this  
JorgeV

Loading XML data from a file in Flash

Recommended Posts

Hello,

 

 

 

I'm new in using FusionCharts and I'm reading the documentation and checking the samples. My project involves a Flash application that on the main page there are 4 areas to display charts. What I want to do is create individual flash files to be loaded into these 4 areas. Each flash movie will display a particular type of chart. The frequency to update the chart is every hour so I will have an XML file ready to be charted. My problem for what I'm reading is that I have to hard code the values for the chart instead of being able to load the XML file as if would be the case for an HTML page?

 

 

 

In your sample flash documents all have SetXMLData and none uses the SetDataURL to point to the XML file as it would be for a HTML is there a way to accomplish this but within the flash movie?

 

 

 

Thanks in advance for the help

Share this post


Link to post
Share on other sites

Hi Jorge,

 

 

 

Could you please try using the following code to retrieve the XML data from XML file?

 

 

 

 

var xmlURLData1=new XML();

 

xmlURLData1.ignoreWhite=true;

 

xmlURLData1.onload=XMLDataLoaded;

 

xmlURLData1.load("data.xml");

 

 

 

function XMLDataLoaded(success)

 

{

 

if (success)

 

{

 

// Sets XML data to the chart.

 

chart1.setXMLData(this);

 

//Draw the charts

 

chart1.render();

 

}

 

else

 

{

 

// Error in loading data.

 

}

 

}

 

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hi Rahul!

 

 

 

Thank you!

 

 

 

The solution works and I have my chart on my movie!

 

 

 

Just one small correction on this line:

 

xmlURLData1.onload=XMLDataLoaded;

 

 

 

Should be: onLoad :)

 

 

 

Thanks again!

 

 

 

Jorge V.

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello Jorge,

Glad that the issue has been solved.

Thank you for correcting the code. :)

Happy FusionCharting.

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