# Storing dynamic mc's in an array

**URL:** <https://forum.kirupa.com/t/storing-dynamic-mcs-in-an-array/113830>\
**Category:** Uncategorized\
**Created:** [June 22, 2004, 5:32am UTC](https://forum.kirupa.com/t/storing-dynamic-mcs-in-an-array/113830 "2004-06-22T05:32:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![goelegant](https://avatars.discourse-cdn.com/v4/letter/g/b19c9b/32.png) [@goelegant](https://forum.kirupa.com/u/goelegant)\
**Post date:** [June 22, 2004, 5:32am UTC](https://forum.kirupa.com/t/storing-dynamic-mcs-in-an-array/113830/1 "2004-06-22T05:32:41Z")

</div>

i am trying to create a menu which is 100% on the fly. the menu item names are stored in a multidimensional array with attatched sub menu items/names. i am trying to create a mc and a txt field for each item in the top menu. i am trying to also store the newly created mc’s and txt fields in an array or their own so i can manage the menu motions/tweens better. however, i get several errors, why wont this work?

// [ed@goelegant.com](mailto:ed@goelegant.com)  
// [http://www.goelegant.com](http://www.goelegant.com)  
// menu.fla

// Do not allow scaling, stop the movie  
Stage.scaleMode = “noScale”;  
Stage.showMenu = false;

//Global TimeLine Reference  
\_global.gTml = this;

//-----------------------------------------------------------  
// these are the variables for the menu, change and expect wonders

// colors to use in the menu, lets keep it pretty  
\_global.myMenuText1 = 10000536;  
\_global.myMenuText2 = 6875903;  
\_global.myMenuText3 = 6865663;

\_global.myX = 100;  
\_global.myY = 100;

// font for menu and whether or not menu items from arrays will be converted to uppercase or not, boolean  
\_global.menuFont = “atlantis\_shared”;  
\_global.menuFontSize = 8;

//-----------------------------------------------------------  
// heres the data we will use to populate the menus nodes

// items in the parent menu  
\_global.parentMenuItems = new Array(“Portfolio”, “Services”, “About”, “Contact”);

// define each child (sub-menu)  
\_global.Portfolio = [“[goelegant.com](http://goelegant.com)”, “[openformats.com](http://openformats.com)”, “[networkprodigy.com](http://networkprodigy.com)”];  
\_global.Services = [“Branding”, “Site Design”, “CMS”, “Custom Web Application”, “Identity”];  
\_global.About = [“Team”];  
\_global.Contact = [“Call Me”, “Contact Form”, “Contact Info”];

// array to hold the movieclips in  
\_global.topMenuMCs = new Array();  
\_global.topMenuTXTs = new Array();

//-----------------------------------------------------------  
// prototypes to use for tweening, motion, etc

// prototype for tweening an object into its designated space with a lil’ bit of style  
MovieClip.prototype.moveIn = function() {  
boxTweenX = new mx.transitions.Tween(this, “\_x”, mx.transitions.easing.Bounce.easeIn, -500, this.\_x, 3, true);  
boxTweenX.cont\_mc = this;  
boxTweenX.onMotionFinished = function() {  
//boxTweenXScale = new mx.transitions.Tween(this.cont\_mc, “\_alpha”, mx.transitions.easing.Strong.easeOut, 99, 50, 1, true);  
[//boxTweenXScale.onMotionFinished](https://boxTweenXScale.onMotionFinished) = this.yoyo();  
}  
}

//-----------------------------------------------------------

// text formating for the menu  
gTml.menu\_fmt = new TextFormat();  
with (menu\_fmt) {  
font = menuFont  
size = menuFontSize  
color = myTextLight;  
}

//-----------------------------------------------------------

// function to draw the top menu  
function drawMenu() {  
for(i = 0; i \< parentMenuItems.length; i ++) {  
topMenuMCs\* = eval(parentMenuItems\* + “\_mc”);  
topMenuTXTs\* = eval(parentMenuItems\* + “\_txt”);  
gTml.createEmptyMovieClip(topMenuMCs\*, gTml.getNextHighestDepth());  
topMenuMCs\*.createTextField(topMenuTXTs\*, gTml.getNextHighestDepth(), myX, myY, 60, 20);  
with (gTml.topMenuMCs\*.topMenuTXTs\*) {  
border = false;  
autoSize = false;  
\_alpha = “99”;  
selectable = false;  
html = false;  
embedFonts = true;  
}  
gTml.topMenuMCs\*.topMenuTXTs\*.text = parentMenuItems\*;  
gTml.topMenuMCs\*.topMenuTXTs\*.setTextFormat(menu\_fmt);  
myY = myY + 30;  
}  
}

//-----------------------------------------------------------  
// lets call functions to start drawing out the stage and moving the mc’s in

// draw the menu  
drawMenu();
