# Problems with variables

**URL:** https://forum.kirupa.com/t/problems-with-variables/157402
**Category:** flash
**Created:** [August 1, 2005, 7:11pm UTC](https://forum.kirupa.com/t/problems-with-variables/157402 "2005-08-01T19:11:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jimjiminyjimjim](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jimjiminyjimjim](https://forum.kirupa.com/u/jimjiminyjimjim)
#### Post date: [August 1, 2005, 7:11pm UTC](https://forum.kirupa.com/t/problems-with-variables/157402/1 "2005-08-01T19:11:49Z")

</div>

I have a loop that creates movie clips where the movie clips are named mc\_+ x for say x = 1 to 10 so the movieclips are called mc\_1, mc\_2…mc\_10.

What I need to do is the know which one of the movieclips is clicked on but more importantly the number i.e if movieclip mc\_2 is clicked on then I need to use the value 2.

At the moment I am sending the value of x to be displayed in a text box within each movieclip:

\_root.search.textfield.text = x;

Then I have a piece of actionscript that uses the value of x but I don’t seem to be able to “re-read” the value of x back with:

var t = \_root.search.textfield.text;

what I want is t = x

is it to do with strings and number variables?

As a different solution is it possible to send the variable x to each movieclip so that it can be called from within each movieclip instead?

thanks
