Back to amCharts.com

Loading the Chart into Another Flash Movie

Normally, the chart is embedded in HTML. However you can load it as a movie clip inside another Flash movie. This requires some knowledge of Adobe Flash.

To insert the chart into your movie, paste the following code snippet into your Flash project:

var listener:Object = new Object(); 
 
listener.onLoadInit = function(target_mc:MovieClip):Void {
    target_mc.path = "ampie/";
    target_mc.settings_file = "ampie/ampie_settings.xml";
    target_mc.data_file = "ampie/ampie_data.xml";
    target_mc.flash_width = "550";
    target_mc.flash_height = "400";
} 
 
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
 
this.createEmptyMovieClip("ampie_mc", this.getNextHighestDepth());
loader.loadClip("ampie/ampie.swf", this.ampie_mc);

You might need to change filenames in the code snippet above.

Alignment and scale

When the chart is loaded into your parent SWF, stage alignment will be changed to "TOP-LEFT". If you don’t want this to happen, add this line to you onLoadComplete function:

target_mc.align = "";

The same with scaling - if you don’t want to use "noScale", add this line:

target_mc.scale = "";

You can find an example of the loader file here: http://extra.amcharts.com/loader.fla

Back to top