# Guessing game problem

**URL:** <https://forum.kirupa.com/t/guessing-game-problem/312411>\
**Category:** Uncategorized\
**Created:** [August 2, 2010, 9:09pm UTC](https://forum.kirupa.com/t/guessing-game-problem/312411 "2010-08-02T21:09:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![markyT](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@markyT](https://forum.kirupa.com/u/markyT)\
**Post date:** [August 2, 2010, 9:09pm UTC](https://forum.kirupa.com/t/guessing-game-problem/312411/1 "2010-08-02T21:09:30Z")

</div>

Hi everyone - I’m a newbie on kirupa, and I wonder if any of you talented people out there can help with this more-than-likely simple problem.

I have 3 movieclips on a stage, all being instances of a square (mc\_square01, mc\_square02, mc\_square03).

What I want to do is on every reload to have a random movieclip to be the ‘correct answer’ - and this is the bit I’m struggling with.

The way i’m testing this out is just to change the alpha of a movieclip on the stage.

Here’s my code…

var myArray:Array = [mc\_square01, mc\_square02, mc\_square03];

mc\_square01.addEventListener(MouseEvent.MOUSE\_OVER, chooseMe);  
mc\_square02.addEventListener(MouseEvent.MOUSE\_OVER, chooseMe);  
mc\_square03.addEventListener(MouseEvent.MOUSE\_OVER, chooseMe);

mc\_square01.buttonMode = true;  
mc\_square02.buttonMode = true;  
mc\_square03.buttonMode = true;

function chooseMe(event:MouseEvent):void {

```
for (var i:Number = 0; i &lt; myArray.length; i++){
myArray[Math.floor(Math.random() * 3)];
myArray*.alpha = .2;
}

```

}

I know it’s something to do with the math.random, but as I’m a newbie, I’ve just about bashed my wall down with my forehead with this.

If anybody could help me, I’d be extremely grateful!
