views:

71

answers:

3

Hi,

I am writing a bit of actionscript that loads an xml file and displays movie clips etc.. appropriately on the stage. However I have come to bit of problem where i want to reset the display via a function through loading a different xml file. I have loaded the new file but the display doesn't change as if its still loaded the previous xml.

Below is the first bit of code that loads the first xml object and runs my function that alters the mcs on the stage.

function CallLineFunction1() {
 xmlFile1="test.xml"
 // set up XML object
 var my_xml1 = new XML();
 my_xml1.ignoreWhite = true;
 my_xml1.onLoad = function(success){ 
 generateRW(my_xml1);
 }
 // load xml into object
 my_xml1.load(xmlFile1); 
}

This works fine. However on the click of a button, I want to load a new xml file to again alter the mcs on the stage. I am using this code to do this:

function CallLineFunction2() {
 xmlFile2="with_disruption_statuses.xml"
 // set up XML object
 var my_xml2 = new XML();
 my_xml2.ignoreWhite = true;
 my_xml2.onLoad = function(success){ 
 generateRW2(my_xml2);
 }
 // load xml into object
 my_xml.load(xmlFile2); 
}

Whilst I've tested that my second generateRW2 statement is run (which it is) the display stays the same using the attributes of the old xml.

I've tried using the delete command but to no avail,

I'm hoping I don't have to copy everything to a second frame and run it from there as there are multiple layers and hundreds of mcs that require alteration depending on the xml data.

Any help appreciated!

A: 

Without seeing generateRW and generateRW2, it's hard to tell what the issue is. However, there are a few things to look for: make sure your previously-loaded movie clips are being removed from the stage, and if you don't want to remove them, make sure you're using unique IDs for the clips.

Jacob
If `generateRW` and `generateRW2` are very similar, do they both contain `createEmptyMovieClip("square_mc", this.getNextHighestDepth())`? If a movie clip named "square_mc" already exists on the stage, that can cause problems. The names must be unique.
Jacob
Thanks Tim, that was an error in my post. I've got round the issue by reloading the movie - pretty simple really. But thanks for your help, its always good to hear other peoples suggestions.
RichW
A: 

ok but its a biggie. This is only generateRW(my_xml1), generateRW2(my_xml2) is very similar

function generateRW(my_xml1){   
lines=my_xml1.firstChild.firstChild.firstChild.childNodes;
stations=my_xml1.firstChild.firstChild.childNodes[1];
for(i=0;i<lines.length;i++){
        offsetNode=lines[i];            
        offsetDisruptions=offsetNode.childNodes[0].childNodes;
        eval("line"+lines[i].attributes.id).infoText="";
        eval("line"+lines[i].attributes.id).infoCount=new Array;
        if(offsetNode.attributes.id=="25DLR"){
            lineDLR="true";
        }
        if(offsetNode.attributes.id=="90OVG"){
            lineOverground="true";
        }
        if(offsetNode.attributes.status.toLowerCase()!="minor delays" && offsetNode.attributes.status.toLowerCase()!="good service"){
        for(k=0;k<offsetDisruptions.length;k++){
            if(offsetDisruptions[k].attributes.affectTimetable=="true"){
                                if(offsetDisruptions[k].childNodes[0].childNodes.length==0){
                                    minorDelayCheck=offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue.substring(0,11);
                                    minorDelayCheck=minorDelayCheck.toLowerCase();
                                    if(minorDelayCheck!="minor delay"){
                                        currentStatus++;
                                        trace('   4. Whole line down:'+lines[i].attributes.id);
                                        segmentMC=eval("line"+lines[i].attributes.id);
                                        infoTextFiltered=filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue);
                                        if(segmentMC.infoText!=infoTextFiltered && segmentMC.infoTextOriginal!=infoTextFiltered){
                                            segmentMC.infoTextOriginal=offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue;
                                            segmentMC.infoText+=filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue);
                                            segmentMC.infoCount.splice(segmentMC.infoCount.length, 0, filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue).length);
                                        }
                                        segmentMC.wholeLineAffected=true;
                                        segmentMC.lineID=lines[i].attributes.id;
                                        segmentMC.onRollOver=function(){
                                            showText(this);
                                        }
                                        segmentMC.onRollOut=function(){
                                            hideText();
                                        }
                                    }
                                } else {                    
                                    segmentMCParent=eval("line"+lines[i].attributes.id);
                                    if(segmentMCParent.infoTextOriginal!=offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue){
                                        segmentMCParent.infoText+=filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue);
                                        segmentMCParent.infoCount.splice(segmentMCParent.infoCount.length, 0, filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue).length);
                                    }
                                    currentStatus++;                    
                                            for(m=0;m<offsetDisruptions[k].childNodes[0].childNodes.length;m++){                                                
                                                trace('    5. Station down: '+offsetDisruptions[k].childNodes[0].childNodes[m].attributes.name);
                                                    segmentMC=eval("line"+lines[i].attributes.id+".mc"+offsetDisruptions[k].childNodes[1].childNodes[m].attributes.id+"_"+offsetDisruptions[k].childNodes[0].childNodes[m+1].attributes.id);            
                                                    if(segmentMC){
                                                        //trace('    segment found: '+eval(segmentMC));
                                                    } else {
                                                        for(n=0;n<offsetDisruptions[k].childNodes[0].childNodes.length;n++) {
                                                            segmentMC=eval("line"+lines[i].attributes.id+".mc"+offsetDisruptions[k].childNodes[0].childNodes[m].attributes.id+"_"+offsetDisruptions[k].childNodes[0].childNodes[n].attributes.id);

                                                            if(segmentMC){
                                                                break;
                                                            } else {
                                                            }
                                                        }


                                                    }
                                                    if(filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue)!=segmentMC.infoText){
                                                        segmentMC.infoText+=filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue);
                                                    }
                                                    segmentMC.infoCount++;
                                                    segmentMC.lineID=lines[i].attributes.id;
                                                    segmentMC.onRollOver=function(){
                                                        showText(this);
                                                    }
                                                    segmentMC.onRollOut=function(){
                                                        hideText();
                                                    }                                       
                                                    segmentMC.disrupted=true;
                                                    eval("mc_interchanges.mc"+lines[i].attributes.id+".mc"+offsetDisruptions[k].childNodes[0].childNodes[m].attributes.id).disrupted=true;
                                                    eval("mc_stations.mc"+offsetDisruptions[k].childNodes[0].childNodes[m].attributes.id).disrupted=true;
                                                    eval("mc_stations.mc"+offsetDisruptions[k].childNodes[0].childNodes[m].attributes.id).infoText=filterMessage(offsetDisruptions[k].childNodes[1].childNodes[0].nodeValue);

                                                }

                                    }


                    }
            }
            offsetStationsNode=stations;
            offsetStationDisruptions=offsetStationsNode.childNodes; 
            for(k=0;k<offsetStationDisruptions.length;k++){
                    if(offsetStationDisruptions[k].attributes.closed.toLowerCase()=="true"){
                            if(offsetStationDisruptions[k].attributes.id!=1000023 && offsetStationDisruptions[k].attributes.id!=1000250){
                            if(eval("mc_stations.mc"+offsetStationDisruptions[k].attributes.id)){
                            currentStatus++;
                            stationMC=eval("mc_stations.mc"+offsetStationDisruptions[k].attributes.id);
                            stationMC.disrupted=true;
                            stationMC.infoText=filterMessage(offsetStationDisruptions[k].firstChild.firstChild.nodeValue);
                            stationMC.stationID=offsetStationDisruptions[k].attributes.id;
                            stationMC.onRollOver=function(){
                                showText(this);
                            }
                            stationMC.onRollOut=function(){
                                hideText();
                            }
                            myColor = new Color(stationMC);
                            myColor.setRGB(rgbRed); 
                            stationMC.createEmptyMovieClip("square_mc", this.getNextHighestDepth());
                            stationMC.square_mc.beginFill(0xFFFFFF);
                            stationMC.square_mc.moveTo(0, 0);
                            stationMC.square_mc.lineTo(stationMC._width+5, 0);
                            stationMC.square_mc.lineTo(stationMC._width, stationMC._height);
                            stationMC.square_mc.lineTo(0, stationMC._height);
                            stationMC.square_mc.endFill();
                            stationMC.square_mc._alpha=0;   
                            stationParentMC="mc"+offsetStationDisruptions[k].attributes.id;
                            for (var prop in mc_interchanges) {
                                if(eval(mc_interchanges[prop][stationParentMC])){
                                    eval(mc_interchanges[prop][stationParentMC]).disrupted=true;
                                }
                            }

                        }
                    }

                }
            }
        }
        lineParent=eval("line"+lines[i].attributes.id);
        if(lineParent.wholeLineAffected==true){             
            interchangeParent=(eval("mc_interchanges.mc"+lines[i].attributes.id));
            for (var prop in interchangeParent) {
                 if (interchangeParent[prop] instanceof MovieClip) {
                    interchangeParent[prop].disrupted=true;
                    eval("mc_stations."+prop).disrupted=true;

                    if(eval("mc_stations."+prop).infoText==undefined){
                        eval("mc_stations."+prop).infoText=eval('line'+lines[i].attributes.id).infoText;

                    } 
                 }
            }

        } else {    
            if(lineParent==_level0.mc_container.mc_loader.line01CIR){
                if(_level0.mc_container.mc_loader.line01CIR.mc1000174_1000072.disrupted==true && _level0.mc_container.mc_loader.line01CIR.mc1000018_1000174.disrupted==true){        
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_south.disrupted=true;
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_north.disrupted=false;
                }
                if(_level0.mc_container.mc_loader.line01CIR.mc1000174_1000072.disrupted==true && _level0.mc_container.mc_loader.line01CIR.mc1000196_1000174.disrupted==true){
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_south.disrupted=false;
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_north.disrupted=true;
                }                                       
                if(_level0.mc_container.mc_loader.line01CIR.mc1000174_1000072.disrupted==true && _level0.mc_container.mc_loader.line01CIR.mc1000072_1000011.disrupted==true){
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_south.disrupted=false;
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_north.disrupted=true;
                }   
                if(_level0.mc_container.mc_loader.line01CIR.mc1000174_1000072.disrupted==true && _level0.mc_container.mc_loader.line01CIR.mc1000072_1000011.disrupted!=true && _level0.mc_container.mc_loader.line01CIR.mc1000196_1000174.disrupted!=true && _level0.mc_container.mc_loader.line01CIR.mc1000018_1000174.disrupted!=true){
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_south.disrupted=true;
                    _level0.mc_container.mc_loader.line01CIR.mc1000174_1000072_north.disrupted=true;
                }                   


            } 
            if(lineParent==_level0.mc_container.mc_loader.line01CEN){
                // Roding Valley to Woodford -- shut down if both stations are disrupted
                if(_level0.mc_container.mc_loader.mc_interchanges.mc01CEN.mc1000194.disrupted==true && _level0.mc_container.mc_loader.mc_interchanges.mc01CEN.mc1000274.disrupted==true){
                    _level0.mc_container.mc_loader.line01CEN.mc1000274_1000194.disrupted=true;
                }           
            }                       
            for (var prop in lineParent) {
                    if (lineParent[prop] instanceof MovieClip) {                        
                     if(lineParent[prop].disrupted!=true){
                        // set to grey
                        myColor = new Color(lineParent[prop]);
                        myColor.setRGB(rgbGrey); 
                     }
                }
            }           
        }
    }
    for (var prop in mc_stations) {
        if (mc_stations[prop] instanceof MovieClip) {
            if (mc_stations[prop].disrupted!=true){
                myColor = new Color(mc_stations[prop]);
                myColor.setRGB(rgbGrey); 
            } else {                
                if(mc_stations[prop].singleClosure==true){

                    mc_stations[prop].onRollOver=function(){
                        showText(this);
                    }
                    mc_stations[prop].onRollOut=function(){
                        hideText();
                    }                               

                }

            }
        }
    }
        for (var prop in mc_interchanges) {
            if (mc_interchanges[prop] instanceof MovieClip) {
                for (var prop2 in mc_interchanges[prop]) {
                    if (mc_interchanges[prop][prop2] instanceof MovieClip) {
                            if(mc_interchanges[prop][prop2].disrupted!=true){           
                                if(mc_interchanges[prop][prop2].mc_black){
                                    myColor = new Color(mc_interchanges[prop][prop2].mc_black);
                                } else {
                                    myColor = new Color(mc_interchanges[prop][prop2]);
                                }

                                //set the colour
                                myColor.setRGB(rgbGrey);
                            } else {

                                if(mc_interchanges[prop][prop2].mc_black){

                                    stackX=parseInt(mc_interchanges[prop][prop2]._x);
                                    stackY=parseInt(mc_interchanges[prop][prop2]._y);
                                    stackID=prop2;
                                        for (var stacked in mc_interchanges) {
                                            for (var stacked2 in mc_interchanges[stacked]) {
                                                if (stacked2 == prop2){
                                                    if(mc_interchanges[stacked][stacked2].disrupted!=true){ 

                                                        testStackX=parseInt(mc_interchanges[stacked][stacked2]._x);
                                                        testStackY=parseInt(mc_interchanges[stacked][stacked2]._y);
                                                        resultX=stackX-testStackX;
                                                        resultY=stackY-testStackY;

                                                        if (resultX >= -2 && resultX <= 2){
                                                            if (resultY >= -2 && resultY <= 2){
                                                                trace('*** !!! stack detected: '+mc_interchanges[stacked][stacked2]);
                                                                trace('***     resultX   :'+resultX);
                                                                trace('***     resultY   :'+resultY);
                                                                trace('***     stackX    :'+stackX);
                                                                trace('***     testStackX:'+testStackX);
                                                                trace('***     stackY    :'+stackY);
                                                                trace('***     testStackY:'+testStackY);
                                                                mc_interchanges[stacked][stacked2]._visible=false;
                                                            }                                                               
                                                        }

                                                    }
                                                }
                                            }
                                        }
                                }
                            }
                        }
                }
            }
        }
trace('Current status: '+currentStatus);
if(line90OVG.mc1000271_1001002.disrupted==true && line90OVG.mc1000271_1001348.disrupted!=true){
    depthTop=line90OVG.mc1000271_1001002.getDepth();
    depthBottom=line90OVG.mc1000271_1001348.getDepth();
    line90OVG.mc1000271_1001348.swapDepths(depthTop);
    line90OVG.mc1000271_1001002.swapDepths(depthBottom);                    
}    
if(line01MET.mc90000167_90001407.disrupted==true && line01MET.mc90019046_90001407.disrupted!=true){
    depthTop=line01MET.mc90000167_90001407.getDepth();
    depthBottom=line01MET.mc90019046_90001407.getDepth();
    line01MET.mc90019046_90001407.swapDepths(depthTop);
    line01MET.mc90000167_90001407.swapDepths(depthBottom);                  
}
if(line01CEN.mc1000274_1000194.disrupted==true && line01CEN.mc1000274_90019033.disrupted!=true){
    depthTop=line01CEN.mc1000274_90019033.getDepth();
    depthBottom=line01CEN.mc1000274_1000194.getDepth();
    line01CEN.mc1000274_1000194.swapDepths(depthTop);
    line01CEN.mc1000274_90019033.swapDepths(depthBottom);
}
if(line01CEN.mc1000258_1000157.disrupted==true && line01CEN.mc1000099_1000157.disrupted!=true){
    depthTop=line01CEN.mc1000099_1000157.getDepth();
    depthBottom=line01CEN.mc1000258_1000157.getDepth();
    line01CEN.mc1000258_1000157.swapDepths(depthTop);
    line01CEN.mc1000099_1000157.swapDepths(depthBottom);
}
if(line01DIS.mc1000094_1000240.disrupted==true && line01DIS.mc1000048_1000240.disrupted!=true){
    depthTop=line01DIS.mc1000048_1000240.getDepth();
    depthBottom=line01DIS.mc1000094_1000240.getDepth();
    line01DIS.mc1000048_1000094.swapDepths(depthTop);
    line01DIS.mc1000048_1000240.swapDepths(depthBottom);                    
}       
if(line01CEN.mc1000137_1000207.disrupted==true && line01CEN.mc1000137_1000250.disrupted!=true){
    depthTop=line01CEN.mc1000137_1000250.getDepth();
    depthBottom=line01CEN.mc1000137_1000207.getDepth();
    line01CEN.mc1000137_1000207.swapDepths(depthTop);
    line01CEN.mc1000137_1000250.swapDepths(depthBottom);                    
}
if(line01MET.mc1000264_1000102.disrupted==true && line01MET.mc1000161_1000102.disrupted!=true){
    depthTop=line01MET.mc1000264_1000102.getDepth();
    depthBottom=line01MET.mc1000161_1000102.getDepth();
    line01MET.mc1000161_1000102.swapDepths(depthTop);
    line01MET.mc1000264_1000102.swapDepths(depthBottom);                    
}
if(line01MET.mc90005973_90004983.disrupted==true && line01MET.mc90019057_90004983.disrupted!=true){
    depthTop=line01MET.mc90005973_90004983.getDepth();
    depthBottom=line01MET.mc90019057_90004983.getDepth();
    line01MET.mc90019057_90004983.swapDepths(depthTop);
    line01MET.mc90005973_90004983.swapDepths(depthBottom);                  
}   
if(line01NTN.mc1000121_1000073.disrupted==true && line01NTN.mc1000121_1000254.disrupted!=true){
    depthTop=line01NTN.mc1000121_1000073.getDepth();
    depthBottom=line01NTN.mc1000121_1000254.getDepth();
    line01NTN.mc1000121_1000254.swapDepths(depthTop);
    line01NTN.mc1000121_1000073.swapDepths(depthBottom);                    
}   
if(line01NTN.mc1000147_1000081.disrupted==true && line01NTN.mc1000081_1000261.disrupted!=true){
    depthTop=line01NTN.mc1000147_1000081.getDepth();
    depthBottom=line01NTN.mc1000081_1000261.getDepth();
    line01NTN.mc1000081_1000261.swapDepths(depthTop);
    line01NTN.mc1000147_1000081.swapDepths(depthBottom);                    
}   
if(line01NTN.mc1000077_1000036.disrupted==true && line01NTN.mc1000152_1000036.disrupted!=true){
    depthTop=line01NTN.mc1000077_1000036.getDepth();
    depthBottom=line01NTN.mc1000152_1000036.getDepth();
    line01NTN.mc1000152_1000036.swapDepths(depthTop);
    line01NTN.mc1000077_1000036.swapDepths(depthBottom);                    
}   
if(mc_interchanges.mc01NTN.mc1000077.disrupted==true && mc_interchanges.mc01VIC.mc1000077.disrupted!=true){
    mc_interchanges.mc01VIC.mc1000077._visible=false;
}   
if(mc_interchanges.mc01CIR.mc1000174.disrupted==true && mc_interchanges.mc01DIS.mc1000174.disrupted!=true){
    mc_interchanges.mc01DIS.mc1000174._visible=false;
}
if(mc_interchanges.mc01CIR.mc1000072.disrupted==true && mc_interchanges.mc01DIS.mc1000072.disrupted!=true){
    mc_interchanges.mc01DIS.mc1000072._visible=false;
}       
if(mc_interchanges.mc01CIR.mc1000072.disrupted!=true && mc_interchanges.mc01HAM.mc1000072.disrupted==true){
    mc_interchanges.mc01CIR.mc1000072._visible=false;
}
if(mc_interchanges.mc01CIR.mc1000072.disrupted==true && mc_interchanges.mc01HAM.mc1000072.disrupted!=true){
    mc_interchanges.mc01HAM.mc1000072._visible=false;
}
if(mc_stations.mc1000096.disrupted==true && mc_stations.mc1000097.disrupted!=true){
    mc_stations.mc1000097._visible=false;
} else if(mc_stations.mc1000097.disrupted==true && mc_stations.mc1000096.disrupted!=true){
    mc_stations.mc1000096._visible=false;
} else {
    mc_stations.mc1000097._visible=false;
}
if(mc_stations.mc1001348.disrupted==true && mc_stations.mc1000203.disrupted!=true){
    mc_stations.mc1000203._visible=false;
} else if(mc_stations.mc1001348.disrupted!=true && mc_stations.mc1000203.disrupted==true){
    mc_stations.mc1001348._visible=false;
} else {
    mc_stations.mc1000203._visible=false;
}
mc_multilines.mc_multi_1002083_1002064._visible=false;
mc_multilines.mc_multi_1002084_1002083._visible=false;
mc_multilines.mc_multi_1002098_1000039._visible=false;
mc_multilines.mc_multi_1002076_1000202._visible=false; //DLR Tower Hill > Shadwell
mc_multilines.mc_multi_1000271_1001002._visible=false; //OVERGROUND Shepherds Bush > Willesden Junction
if(mc_stations.mc1001348.disrupted==true && mc_stations.mc1000271.disrupted==true){
    mc_multilines.mc_multi_1000271_1001002._visible=false;
}
if(mc_stations.mc1002083.disrupted==true && mc_stations.mc1002064.disrupted==true && mc_stations.mc1002084.disrupted==true){
    mc_multilines.mc_multi_1002083_1002064._visible=true;
    mc_multilines.mc_multi_1002084_1002083._visible=true;
}   
if(line25DLR.mc1002084_1002064.disrupted==true && line25DLR.mc1002084_1002083.disrupted!=true){
    depthTop=line25DLR.mc1002084_1002083.getDepth();
    depthBottom=line25DLR.mc1002084_1002064.getDepth();
    line25DLR.mc1002084_1002064.swapDepths(depthTop);
    line25DLR.mc1002084_1002083.swapDepths(depthBottom);            
}
if(line25DLR.mc1002084_1002083.disrupted==true && line25DLR.mc1002064_1002083.disrupted!=true){
    depthTop=line25DLR.mc1002064_1002083.getDepth();
    depthBottom=line25DLR.mc1002084_1002083.getDepth();
    line25DLR.mc1002084_1002083.swapDepths(depthTop);
    line25DLR.mc1002064_1002083.swapDepths(depthBottom);            
}
if(line25DLR.mc1000202_1000013.disrupted==true && line25DLR.mc1000202_1002076.disrupted!=true){
    depthTop=line25DLR.mc1000202_1000013.getDepth();
    depthBottom=line25DLR.mc1000202_1002076.getDepth();
    line25DLR.mc1000202_1002076.swapDepths(depthTop);
    line25DLR.mc1000202_1000013.swapDepths(depthBottom);            
}
if(line25DLR.mc1002098_1000039.disrupted==true && line25DLR.mc1002071_1000039.disrupted==true){
    mc_multilines.mc_multi_1002098_1000039._visible=true;
}
if(line25DLR.mc1002098_1000039.disrupted==true && line25DLR.mc1002071_1000039.disrupted!=true){
    depthTop=line25DLR.mc1002071_1000039.getDepth();
    depthBottom=line25DLR.mc1002098_1000039.getDepth();
    line25DLR.mc1002098_1000039.swapDepths(depthTop);
    line25DLR.mc1002071_1000039.swapDepths(depthBottom);
}   
if(lineOverground!="true"){
    myColor = new Color(line90OVG);
    myColor.setRGB(rgbGrey);
    eval(line90OVG).disrupted="false";
}
if(lineDLR!="true"){
    myColor = new Color(line25DLR);
    myColor.setRGB(rgbGrey);    
    myColor = new Color(mc_multilines);
    myColor.setRGB(rgbGrey);    
    eval(line25DLR).disrupted="false";
}
mc_furniture._visible=false;
myColor = new Color(mc_thames);
myColor.setRGB(rgbGrey); 
myColor = new Color(mc_eastLondonLine);
myColor.setRGB(rgbGrey);    
_root.mapLoadStatus=true;   
if(_root.xmlTimeStamp=="true"){
    trace(_root.xmlTimeStamp);
    mc_timestamp._visible=true;
} else {
    mc_timestamp._visible=false;
}   
if(offset!=undefined && offset!="normal"){  
    if(currentStatus==0){
        _root.mc_good_service._visible=true;
    } else {
        mc_good_service._visible=false;
    }
} else {        
    mc_good_service._visible=false;
}   
}
RichW
Just for future reference, instead of posting follow-ups as answers, edit your original question with additional information.
Jacob
A: 

In CallLineFunction2, is this a typo in your post, or in your code?

 // load xml into object
 my_xml.load(xmlFile2); 

Because the instance in the method is called "my_xml2".

Tim B.