# Using random code

**URL:** <https://forum.kirupa.com/t/using-random-code/6582>\
**Category:** flash\
**Created:** [October 10, 2002, 10:01pm UTC](https://forum.kirupa.com/t/using-random-code/6582 "2002-10-10T22:01:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RockerDude](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@RockerDude](https://forum.kirupa.com/u/RockerDude)\
**Post date:** [October 10, 2002, 10:01pm UTC](https://forum.kirupa.com/t/using-random-code/6582/1 "2002-10-10T22:01:54Z")

</div>

Hello,  
Got a simple little problem which I can’t seem to find on any of the tutorials so hope one of ya’s can help me out here. I have a simple little game I have created, similar to the street game where they mix the 3 cards and you choose what its under or which card its under. I have everything working fine but what syntax do I use to have the person choose the right one? in other words, I am familiar with hit test using MC’s, but what about when the person is using his mouse and clicks on the right MC, what code would I use to see if its the right one that he chose? Hope you all understand what I am asking. Thanks,  
Rocker

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 2:29am UTC](https://forum.kirupa.com/t/using-random-code/6582/2 "2002-10-11T02:29:48Z")

</div>

bunch of different ways to do this… a bunch. For just three cards, and a single chance to guess where the “lady” is… one option could be to assign a variable when one of the cards is chosen and check against the variable.

so, when the movie starts you could have a variable

pickacard=none;

if they click on black

on(release){  
\_root.pickacard=black;  
trace(“you lose”);  
}

on the red card…

on(release){  
if(\_root.pickacard!=black){  
trace(“you win”);  
}

that is a simple and crude method, but I think it shoud work. Like a said… bunch of different ways to do it…
