# Linking an MC to a VAR

**URL:** <https://forum.kirupa.com/t/linking-an-mc-to-a-var/190964>\
**Category:** flash\
**Created:** [June 15, 2006, 11:27pm UTC](https://forum.kirupa.com/t/linking-an-mc-to-a-var/190964 "2006-06-15T23:27:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rustyd](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@Rustyd](https://forum.kirupa.com/u/Rustyd)\
**Post date:** [June 15, 2006, 11:27pm UTC](https://forum.kirupa.com/t/linking-an-mc-to-a-var/190964/1 "2006-06-15T23:27:35Z")

</div>

Greetings,

My first Flash game is in progress so please prepare to laugh, guffaw and/or thank any diety you wish that your skills are not as bad as mine!

I am making a Rock-Paper-Scissors game because I actually saw an R-P-S tournement on TV. Man, those people take it seriously!

Anyway, I am probably going about a lot of things the wrong way, but what I need help on is how to display an MC based on the output of a random (1 to 3) variable created for the PC side (the Opponent) of the game with:

```auto
var PCPlayer = this.values = new Array(1, 2, 3);
trace(PCPlayer[Math.floor(Math.random() * this.values.length)]);

```

All is well here and I actually get a random number (insert applause here).

**So, what I want to do with that random number is to display the rock\_mc if the var=1, the paper\_mc if it’s 2 and scissors\_mc if the var=3.**

If I can get that nailed down, then after a 3,2,1 GO; the Player will press Left, Down or Right to generate their selection - I have NOT got to that part yet where it will then compare using a Case statement. I know I’ll have to add listeners and such and believe that, if I can get the problem above solved, I may be able to finish the rest…(insert doubt here).

I hope this makes sense. The FLA is available - about 500k: [http://www.reddenweb.com/flash/rps.zip](http://www.reddenweb.com/flash/rps.zip)

Thanks in advance for any advice.

Rustyd
