try this.

var _menuArray:Array = new Array();
var _baseName:String = "mc_menu";

for (var i:Number = 0; i < 20; i++) {
   _menuArray.push( this.createEmptyMovieClip( _baseName+i,
this.getNextHighestDepth()) );
}

that will do it... but you may want to create an instance of a mc and not an
empty one. look up attachMovie()

also your code wouldn't work... why you ask?
- you have a function that creates your mc's that is not even called!
- if you actually did call you would only get mc as you are constantly
setting the new mc at the same depth






On 07/03/06, murder design <[EMAIL PROTECTED]> wrote:
>
> i am trying to dynamically create 20 movieclips. i want to name them
> dynamically, and reference the clip within an array. is this the best way
> to
> go about it? will this even work?...
>
> // array to hold dynamically created movieclips within
> myItems = new Array();
>
> // add a movie clip
> function addMenuElement(myName:String) {
> var myName:MovieClip = _root.createEmptyMovieClip(myName, 0);
> myItems.push(myName);
> };
>
> // all movieclips are named according myMC and a number
> myName = "myMC";
>
> // create 20 movieclips
> for(var x:Number = 0; x < 20; x++) {
> y = "menu" + x.toString() + "_mc";
> myName = y;
> trace(myName);
> }
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>



--
Go Dennis!
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to