# Extracting argument from array

**URL:** <https://forum.kirupa.com/t/extracting-argument-from-array/330395>\
**Category:** flash\
**Created:** [January 14, 2013, 1:52pm UTC](https://forum.kirupa.com/t/extracting-argument-from-array/330395 "2013-01-14T13:52:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chilliroom](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@chilliroom](https://forum.kirupa.com/u/chilliroom)\
**Post date:** [January 14, 2013, 1:52pm UTC](https://forum.kirupa.com/t/extracting-argument-from-array/330395/1 "2013-01-14T13:52:13Z")

</div>

I have 4 arrows (up, down, left, right) and wish to activate only one whilst deactivating the rest. I have cast their instance names in an array & would like to pass one as an argument to a function (to activate). But how does one select the values not in the string but in the array (to deactivate)?

I know this is incorrect yet indicates the idea:

function ArrowActive(mc:String){  
var arrows = Array;  
arrows = [arrowUp, arrowDown, arrowLeft, arrowRight];

// turn on active arrow  
mc.gotoAndStop(2);

// turn off active arrows  
for each(var a:MovieClip in arrows! indexOf(mc)){  
a.gotoAndStop(1);

}  
}

Many thanks
