Sign in to follow this  
flex101101

Charts crashing Flash

Recommended Posts

I think it is a an as library issue because when I was initially making the charts I just wanted to load the swf file, and did not remove the includes or import code for any of the charts in the main timeline. Instead I just opted to load the ready swf file at each slide in the main timeline. Everything works fine as I proceed from one slide to the next, each time loading a different chart no problem, but when I go backwards to a previously loaded chart or restart the movie, it crashes flash. Some sample code is below:

#include "com/fusioncharts/includes/LoadingFunctions.as"
#include "com/fusioncharts/includes/AppMessages.as"
import com.fusioncharts.core.charts.Pie2DChart;
var strXML:String = "";
//Add simple data for demo.
strXML = strXML + "<chart palette='1' alpha='0' bgAlpha='0' 
yAxisValuesPadding='10' baseFontColor='000000' decimals='0' 
bgColor='ffffff' pieRadius='145' showBorder='0' showPercentageValues='1' 
labelDisplay='WRAP' labelSepChar=' ' labelDistance='0' showToolTip='0' 
use3DLighting='1' caption='2006 Procedure Distribution' baseFont='arial' 
baseFontSize='14' showvalues='1' showCanvasBg='0'>";
strXML = strXML + "<set label='Isolated C' value='373' isSliced='1' />";
strXML = strXML + "<set label='Isolated V' value='42' />";
strXML = strXML + "<set label='Combined CV' value='61'  />";
strXML = strXML + "</chart>";
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:Pie2DChart = new Pie2DChart(chartContainerMC, 1, 550, 425,
20, 15, false, "EN", "noScale");
//Convey the XML data to chart. 
myFirstChart.setXMLData(xmlData);
//Draw the chart
myFirstChart.render();
//Stop
stop();

Share this post


Link to post
Share on other sites

Also, just so you on each slide I load the chart with the following As code:

loadMovie("chart_test_1.swf", chart_mc);

loadMovie("chart_test_2.swf", chart_mc);

loadMovie("chart_test_3.swf", chart_mc);

and so on, with an emtpy clip with an instance name of chart_mc as the placeholder.

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