Help combining code into one script

I have two piece of code that I am trying to work together into one piece of code. They are taken from different projects I have. The first section of code loads external swfs and then plays them one after the other. The second section of code the Menu code creates a menu.

I want to combine these two pieces so the swfs play automatically when the movie starts and then if I click on one of the menu buttons have it play that swf, and when that swf is done playing, if there are no other menu selections it needs to pick up the next swf in the correct order automatically.

What is happening now is none of the swfs play unless I comment out the Menu code. If I place the Menu code in a different layer the swfs will play but I don’t have any connections.

Can some one help me connect these two chunks of code into one? I would attach the fla, but it’s to large for the forum. Really though the only thing you need to make this work are some external swfs and a movieClip with a dynamic text box, instance name “tf” and for the movieClip a linkage identifier of “btnMC”. The stage should be set to 800x600.


_root.createEmptyMovieClip("animZone_mc", 0);
_root.animZone_mc.clips_array = ["Culture_History.swf", "Claims.swf", "indepth_Comm.swf", "indepth_Personal.swf", "Agribusiness.swf", "indepth_Surety.swf", "Billings.swf"];
_root.animZone_mc.nextClipIndex = 0;
_root.animZone_mc.readyToLoadNext = true;
_root.animZone_mc.createEmptyMovieClip("container_mc", 0);
_root.animZone_mc.onEnterFrame = function() {
 if (this.clips_array.length>this.nextClipIndex) {
  if (this.readyToLoadNext) {
   trace("loading: "+this.clips_array[this.nextClipIndex]);
   this.container_mc.loadMovie(this.clips_array[this.nextClipIndex]);
   this.container_mc._lockroot = true;
   this.nextClipIndex++;
   this.readyToLoadNext = false;
  } else {
   if (this.container_mc._totalframes == this.container_mc._currentframe && this.container_mc._totalframes != 0) {
    trace("anim finished");
    this.readyToLoadNext = true;
   }
  }
 } else {
  trace("delete loop");
  delete this.onEnterFrame;
 }
};
//
//
//
// SET UP MENU ARRAY // 
_global.labels_array = new Array();
_global.labels_array.push("");
_global.labels_array.push("CULTURE & VALUES");
_global.labels_array.push("|");
_global.labels_array.push("CLAIMS");
_global.labels_array.push("|");
_global.labels_array.push("COMMERCIAL LINES");
_global.labels_array.push("|");
_global.labels_array.push("PERSONAL LINES");
_global.labels_array.push("|");
_global.labels_array.push("FARM & AGRICULTURE");
_global.labels_array.push("|");
_global.labels_array.push("SURETY");
_global.labels_array.push("|");
_global.labels_array.push("BILLING");
// START BUILDING THE MENU //
_global.myMenuClips = [];
startXPos = 0;
mySpaceVar = 5;
// calculate the total length of the array
for (var i = 0; i<_global.labels_array.length; i++) {
 _global.btn = _root.attachMovie("btnMC", "btn_"+i, i);
 _global.myMenuClips.push(_global.btn);
 _global.btn._y = 562;
 _global.btn.tf.text = _global.labels_array*;
 _global.btn.tf.autoSize = true;
 _global.btn._x = startXPos;
 startXPos = startXPos+_global.btn._width+mySpaceVar;
 _global.btn.num = i;
}
totalwidth = _global.btn._x+_global.btn._width;
//
if (totalwidth>=800) {
 startXPos = (totalwidth-800)/2;
} else if (totalwidth<=800) {
 startXPos = (800-totalwidth)/2;
}
// rebuild the menu using the known values
mySpaceVar = 5;
for (var i = 0; i<_global.labels_array.length; i++) {
 _global.btn = _root.attachMovie("btnMC", "btn_"+i, i);
 _global.myMenuClips.push(_global.btn);
 _global.btn._y = 562;
 _global.btn.tf.text = _global.labels_array*;
 _global.btn.tf.autoSize = true;
 _global.btn._x = startXPos;
 startXPos = startXPos+_global.btn._width+mySpaceVar;
 _global.btn.num = i;
 //
 // check text and disable the button functions if the text is "|"
 if (_global.btn.tf.text != "|") {
  //trace("true");
  this.onRollOver.enabled = false;
  this.onRollOut.enabled = false;
  this.onPress.enable = false;
  //
  gotFocus = function (obj) {
   lostFocus(this.prev);
   this.prev = obj;
   var c = new Color(obj);
   c.setRGB(SELECTCOLOR);
  };
  lostFocus = function (obj) {
   content.unloadMovie();
   var c = new Color(obj);
   c.setRGB(DEFAULTCOLOR);
  };
  // set button state colors
  var SELECTCOLOR = 0x000000;
  var OVERCOLOR = 0xAD6827;
  var DEFAULTCOLOR = 0xFFFFFF;
  var prev = null;
  // create a color object
  btn.c = new Color(btn);
  btn.c.setRGB(DEFAULTCOLOR);
  // set first button to indicate on state
  if (labels_array[1] == "CULTURE & VALUES") {
   gotFocus(btn_1);
  }
  //
  btn.onRollOver = function() {
   //trace(this);
   //trace("btn "+this.getDepth())
   //trace(this.tf.text);
   if (_root.prev != this) {
    this.c.setRGB(OVERCOLOR);
   }
  };
  btn.onRollOut = function() {
   if (_root.prev != this) {
    this.c.setRGB(DEFAULTCOLOR);
   }
  };
  btn.onRelease = function() {
   if (_root.prev != this) {
    gotFocus(this);
    //trace("text = " +this.tf.text)    
    //    
    if (this.tf.text == "CULTURE & VALUES") {
    }
    //
    if (this.tf.text == "CLAIMS") {
    }
    //
    if (this.tf.text == "COMMERCIAL LINES") {
    }
    //
    if (this.tf.text == "PERSONAL LINES") {
    }
    //
    if (this.tf.text == "FARM & AGRICULTURE") {
    }
    //
    if (this.tf.text == "SURETY") {
    }
    //
    if (this.tf.text == "BILLING") {
    }
    //
   } else {
    trace("not loaded");
   }
  };
 }
}