Nested inside your own Flash movies/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();
    addChild(container);
    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
    }
    with(loadSWF){
        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
    container.dataURL=dataURL;
    // set the dimension, width, height and xy start of the nested movie
    container.chartWidth=chartWidth;
    container.chartHeight=chartHeight;
    container._xShift=_xShift;
    container._yShift=_yShift;
    // set the variables of the textFormat
    container.PBarTextFont=PBarTextFont;
    container.PBarTextColor=PBarTextColor;
    container.PBarTextSize=PBarTextSize;
    container.PBarTextBold=PBarTextBold;
    // set the Text
    container.PBarLoadingText=PBarLoadingText;
    container.XMLLoadingText=XMLLoadingText;
    // determine the preloader (0 for percentage bar or 1 for the arrow)
    container.IsArr=IsArr;
    // set only certain variables depending on the choice of the preloader
    if(IsArr){
        container.ArrLength=ArrLength;
        container.ArrColor=ArrColor;
        container.ArrWidth=ArrWidth;
        container.ArrHeight=ArrHeight;
        container.ArrSpace=ArrSpace;
        container.ArrThickness=ArrThickness;
        container.ArrFeather=ArrFeather;
    }else{
        container.PBarHeight=PBarHeight;
        container.PBarWidth=PBarWidth;
        container.PBarBorderColor=PBarBorderColor;
        container.PBarBorderThickness=PBarBorderThickness;
        container.PBarBgColor=PBarBgColor;
    }
    container.addChild(loadSWF);
}
// 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
stop();
// 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);
    oCount++;
    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[this["ohold"+i].moveName].play();
            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 chart movies can be loaded or nested inside your own flash movies/applications (flash MX 6-8 AS1-AS2 and flash 9-10 AS3).

Note, this method is for Flash developers/designers only!

Simply copy and paste the code above to an action-script frame inside your flash document in the flash authoring environment.

Edit this source code as you like. Please do read the comments for further information.

In the example source codes two or three different charts are loaded. The 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 chart movie file 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 which can be found on advance-media's website (showcase LIVE) to learn how to manipulate the embedded or nested charts after loading.