Nested inside your own Flash movies and Air applications

flash Container

//--------------- chartContainer ------------ Flash (9-10 AS3) ----------------//
// Use this chartContainer snippet to load single or multiple instances of the Flash (9-10 as3) chart movie nested or embedded inside another Flash (9-10 as3) movie.
// Edit this script as you like.
var loadCharts:Function= function (bootSWF:String, dataURL:String, chartWidth:uint, chartHeight:uint, _xShift:int, _yShift:int, PBarTextFont:String, PBarTextColor:String, PBarTextSize:uint, PBarTextBold:uint, PBarLoadingText:String, XMLLoadingText:String, IsArr:uint, ArrLength:uint, ArrColor:String, ArrWidth:uint, ArrHeight:uint, ArrSpace:int, ArrThickness:uint, ArrFeather:uint, PBarHeight:uint, PBarWidth:uint, PBarBorderColor:String, PBarBorderThickness:uint, PBarBgColor:String):void {
    var container:MovieClip=new MovieClip();
    container.stop(); // save CPU usage
    var loadSWF:Loader = new Loader();
    var ioErrorHandler:Function = function (event:IOErrorEvent):void {
        // dummy ioError (404 file not found) catch function
        contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        load(new URLRequest(bootSWF)); // bootSWF points to the flash 3D charts movie's path and name
    // set initial variables beginning with dataURL pointing to the external xml file's path and name, any chart variable set to 'null' will be set to its default value
    // set the dimension, width, height and xy start of the nested movie
    // set the variables of the textFormat
    // set the Text
    // determine the preloader (0 for percentage bar or 1 for the arrow)
    // set only certain variables depending on the choice of the preloader
// call the loader function for each nested 3D charts movie
loadCharts("AMchart_as3.swf","nested_combi.xml", 550, 415, 130, 0, "Verdana", "00bb33", 14, 1, "Loading Chart", "Loading Data", 0, null, null, null, null, null, null, null, 20, 200, "00bb33", 0, "00ff66");
loadCharts("AMchartPie_as3.swf","nested_pie.xml", 550, 400, -30, -50, "Verdana", "00bb33", 14, 1, "Loading Chart", "Loading Data" ,1, 210, "00ff66", 150, 66, 20, 23, 8, null, null, null, null, null);
loadCharts=null; // clear memory, delete, make this function eligible for the as3 garbage collector
stop(); // save CPU usage

stage.frameRate=40; // optionally set the frame rate here or in the properties document panel. All loaded instances will play having this frameRate.

//--------------- chartContainer ------------ Flash (6-8 AS1-AS2) ----------------//
//Use this chartContainer snippet to load single or multiple instances of the Flash (6 MX) chart movie nested inside another Flash (6-8 as1-as2) movie.
// stopping this frame to save cpu usage, optional
// internally used incrementer variable
var oCount = 0;
// This is the function that loads the Charts.swf movie and stores all initial variables in an Object.
// retrieved variables:
// moveName is the unique reference name of the MC holder, use it e.g. to delete or to hide the chart with 'unloadMovie' or '_visible'
// strSWFName is the path to the chart.swf movie
// chartStartLevel is level where to render the chart
// strURL is the path to the external xml Data file
// intChartWidth width of the chart
// intChartHeight height of the chart
// intChartStartX the chart container movie MC is created on the xy axis 0,0 point, set the offset here
// intChartStartY Y offset where to start rendering the chart
// note, add further variables here and in the onEnterFrame function below to manipulate e.g. the preloader, the variable names and a detailed description can be found in the html setup
loadChart = function (moveName, strSWFName, chartStartLevel, strURL, intChartWidth, intChartHeight, intChartStartX, intChartStartY) {
    this.createEmptyMovieClip(moveName, chartStartLevel);
    this["ohold"+oCount] = new Object();
    this["ohold"+oCount].moveName = moveName;
    this["ohold"+oCount].strURL = strURL;
    this["ohold"+oCount].intChartWidth = intChartWidth;
    this["ohold"+oCount].intChartHeight = intChartHeight;
    this["ohold"+oCount].intChartStartX = intChartStartX;
    this["ohold"+oCount].intChartStartY = intChartStartY;
    // add variables here to manipulate the preloader
    loadMovie(strSWFName, moveName);
// ****** loading e.g. 3 chart movies **** edit here ****
loadChart("MovChart1", "../AMchart.swf", 103, "Data.xml", 550, 450, 230, 150);
loadChart("MovChart2", "../AMchartPie.swf", 104, "Data_pie3.xml", 550, 400, 10, 10);
loadChart("MovChart3", "../AMchartPie.swf", 105, "Data_pie3.xml", 550, 400, 70, 100);
// delete the loader function from the memory
delete loadChart;
// the onEnterFrame function actually checks (chartLoadInit == true) if the first frame of the chart movie is loaded and sends the initial variables afterwards.
this.onEnterFrame = function() {
    // loadComplete is internally used to delete this function after use
    var loadComplete = true, i;
    for (i=1; i<=oCount; i++) {
        if (this[this["ohold"+i].moveName].chartLoadInit == true and this["ohold"+i].isLoadede != true) {
            this[this["ohold"+i].moveName].dataURL = this["ohold"+i].strURL;
            this[this["ohold"+i].moveName].chartWidth = this["ohold"+i].intChartWidth;
            this[this["ohold"+i].moveName].chartHeight = this["ohold"+i].intChartHeight;
            this[this["ohold"+i].moveName]._xShift = this["ohold"+i].intChartStartX;
            this[this["ohold"+i].moveName]._yShift = this["ohold"+i].intChartStartY;
            // add desired variables here to manipulate the preloader
            this["ohold"+i].isLoadede = true;
        if (this["ohold"+i].isLoadede != true) {
            loadComplete = false;
    // deleting all variables and objects and this function from memory
    if (loadComplete == true) {
        for (i=1; i<=oCount; i++) {
            delete this["ohold"+i];
        delete oCount;
        delete this.onEnterFrame;

Single or multiple instances of the Flash 3D charts movies can be loaded or nested inside your own flash movies and Air applications (flash MX 6-8 AS1-AS2 and flash 9-10 AS3, the flash 10 version can be embedded in an AS3 flash 9 movie but will require the flash 10 Plug-In to play).

Note, this method is for Flash and Air etc. developers/designers only!

Simply copy and paste the code above to an action-script frame inside your flash document in the flash authoring environment. The paths should point to the external 3D Charts movie and a valid XML data file.

Edit this source code as you like. Please do read the comments for further information. The container's alpha transparency values (F10 got full support here for dynamic fonts which are used by the 3D charts) can be set even after loading but moving the container's XY position or changing its scaling after loading is restricted. Setting the initial xy position width and height of a chart is shown in the above demo though.

In this example source codes snippet two or three different 3D charts are loaded at once. The 3D charts are overlapping each other to e.g. render a terrific cover image. (The flash names in the flash MX 6-8 AS1-AS2 demo of the MC movieClip instances are called MovChart1, MovChart2 and MovChart3.) The path to the swf flash 3D charts movie files and to its XML data and the render level and position etc. are set above. Please refer to the '4 in 1' nested chart application demo + zip including fla files which can be found on ADVANCE-MEDIA's website (page: 'showcase LIVE') to learn how to further manipulate the embedded or nested charts after loading e.g. how to unload a chart.

The 3D charts movies do support a dynamic xml boot alternative:
Instead of a path and name pointing to the external xml file (here: the variable called 'dataURL' points or is set to an external file called "nested_pie.xml") an alternative approach to provide the 3D charts movie with its xml data is supported. Simply inject the whole xml structure and pass it directly to this 'dataURL' variable like:

in Flash (9-10 AS3):

loadCharts("AMchartPie_as3.swf","<chart by='' caption='Media Company' ... ... ... </chart>", 550, 400, -30, -50, "Verdana", "00bb33", 14, 1, "Loading Chart", "Loading Data" ,1, 210, "00ff66", 150, 66, 20, 23, 8, null, null, null, null, null);

in Flash (6-8 AS1-AS2):

loadChart("MovChart2", "../AMchartPie.swf", 104, "<chart by='' caption='Media Company' ... ... ... </chart>", 550, 400, 10, 10);

Do not get confused with mixing up double and single quotation marks standing for either the beginning and end of the 'dataURL' variable or standing for the beginning and end of the xml attribute's value. Do not supply a blank space before the whole xml structure starting with "<chart ... " and do not use line feeds or carriage returns inside the entire xml structure. This method is useful e.g. for building dynamic applications, you could easily inject data to the 3D charts after executing a SQLStatement native to AIR or render 3D charts in Flash depending on a calculated result by means of "<chart ... <set value='"+myVar+"' /> ... </chart>". Note the variable called myVar.
This method is quite fast because no URL is firstly send to the flash movie yet it is not as memory efficient because the xml structure is not just read by the 3D charts flash movie. This method will limit the 3D charts' own refresh/reload option.
Moreover let's take a look at an image of a high volume 3D chart consisting of over 14.000 data points. One of my 3D charts' customers did send in this picture. It did exceed all expectations. This 3D chart was nested in Adobe Air AS3 as it would consume too much browser plug-in resources. Realizing this in a 2D scenario is problematic. Even a 2D line chart would not suit the sometimes sporadic values nor datasets having the same value range.