# Have i not understood the idexOf functions with arrays?

**URL:** <https://forum.kirupa.com/t/have-i-not-understood-the-idexof-functions-with-arrays/288422>\
**Category:** Uncategorized\
**Created:** [May 15, 2009, 2:29pm UTC](https://forum.kirupa.com/t/have-i-not-understood-the-idexof-functions-with-arrays/288422 "2009-05-15T14:29:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vidar](https://avatars.discourse-cdn.com/v4/letter/v/e36b37/32.png) [@Vidar](https://forum.kirupa.com/u/Vidar)\
**Post date:** [May 15, 2009, 2:29pm UTC](https://forum.kirupa.com/t/have-i-not-understood-the-idexof-functions-with-arrays/288422/1 "2009-05-15T14:29:59Z")

</div>

way doesn’t this work?

```auto

var rettRute:Array = new Array("r1", "r2", "r3");

function squareClick(m:MouseEvent) {
   trace(m.target.name);
   fargeRett.color=0x000000;
   fargeFeil.color=0xff0000;
   if (m.target.name==rettRute.indexOf(m.target.name, 0)) {    
      m.target.transform.colorTransform=fargeRett;
   } else {
      m.target.transform.colorTransform=fargeFeil;

   }
}

```
