# Detecting which random movie is loaded

**URL:** <https://forum.kirupa.com/t/detecting-which-random-movie-is-loaded/68278>\
**Category:** programming\
**Created:** [October 23, 2004, 10:35pm UTC](https://forum.kirupa.com/t/detecting-which-random-movie-is-loaded/68278 "2004-10-23T22:35:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kennyb](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@kennyb](https://forum.kirupa.com/u/kennyb)\
**Post date:** [October 23, 2004, 10:35pm UTC](https://forum.kirupa.com/t/detecting-which-random-movie-is-loaded/68278/1 "2004-10-23T22:35:33Z")

</div>

I’m building a Freecell type card game. I’ve got an array that loads all of the cards (actually, the linkage names for each card loaded from the library with attachMovie). I randomize the array before I “deal the cards” onto the stage.

Here’s a little code snipet where “deal” starts off equaling 0 and “cardDeck” is the value from my array (for example, c5 equals 5 of Clubs):

```auto

if (deal<52) {
    _root.createEmptyMovieClip("card"+deal, deal);
    _root["card" + deal].attachMovie(cardDeck[deal],cardDeck[deal],deal);
deal++
}

```

There’s more, of course. My problem is - How can I detect which card loaded into which movie? For example, I know I have a movie called \_root.card6 at the bottom of the first column, how can I know what card is loaded into \_root.card6?
