# Assign movieclip to variable from string name...?

**URL:** <https://forum.kirupa.com/t/assign-movieclip-to-variable-from-string-name/328842>\
**Category:** Uncategorized\
**Created:** [June 22, 2012, 8:35pm UTC](https://forum.kirupa.com/t/assign-movieclip-to-variable-from-string-name/328842 "2012-06-22T20:35:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeekTweak\_0](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@GeekTweak\_0](https://forum.kirupa.com/u/GeekTweak_0)\
**Post date:** [June 22, 2012, 8:35pm UTC](https://forum.kirupa.com/t/assign-movieclip-to-variable-from-string-name/328842/1 "2012-06-22T20:35:16Z")

</div>

So i am trying to make a solitaire game, and in my library i have a full deck of cards, each card as a separate movieclip. For example: \*Spade\_A, Spade\_2, Spade\_3, Spade\_4.

_So in my as3 code i have a 2d array, and in a loop (or set of loops) i assign each card’s importable name to the variable. EG_: cardArray[0][0] = “Spade\_A”, cardArray[0][1] = “Spade\_2”, cardArray[0][2] = “Spade\_3”. and etc.

\*So the problem i am having iswhen i want to assign that, to a variable like so:

\*var cardName = new cardArray[0][2].name;  
this.addChild(cardName);

_what would be the most efficient way to do this?_

thanks.  
\*
