# Resolving a tie in an array

**URL:** <https://forum.kirupa.com/t/resolving-a-tie-in-an-array/283488>\
**Category:** Uncategorized\
**Created:** [March 6, 2009, 7:37pm UTC](https://forum.kirupa.com/t/resolving-a-tie-in-an-array/283488 "2009-03-06T19:37:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![risita](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/risita/32/1050_2.png) [@risita](https://forum.kirupa.com/u/risita)\
**Post date:** [March 6, 2009, 7:37pm UTC](https://forum.kirupa.com/t/resolving-a-tie-in-an-array/283488/1 "2009-03-06T19:37:39Z")

</div>

Hi,

I have a bunch of numeric variables in an array. They correspond to the \_y value of some movieclips in the movie. These values change through the movie, and at the end I’m trying to figure out which movieclip’s .\_y is the lowest. The problem is sometimes more than one movieclip ends up in the same spot. Here’s what the code looks like:

var squareY:Number = shapes\_mc.square\_gfx.box.\_y;  
var circleY:Number = shapes\_mc.circle\_gfx.box.\_y;  
var triangleY:Number = shapes\_mc.triangle\_gfx.box.\_y;  
var hexagonY:Number = shapes\_mc.hexagon\_gfx.box.\_y;  
var rectangleY:Number = shapes\_mc.rectangle\_gfx.box.\_y;  
var ovalY:Number = shapes\_mc.oval\_gfx.box.\_y;

var shapesY:Array = new Array(squareY, circleY, triangleY, hexagonY, rectangleY, ovalY);  
categsY.sort();

/\* find out which shape is lowest \*/  
if (categsY[0] == squareY){  
square\_mc.\_mc.alphaTo(100, 1, “linear”, 1);  
}

then more if statements for the other movieclips. It works, but if more than one movieclip end at the same \_y position, they all fade in. Is there a way to get just one of them?
