# Working with an array

**URL:** <https://forum.kirupa.com/t/working-with-an-array/317253>\
**Category:** flash\
**Created:** [December 14, 2010, 11:35pm UTC](https://forum.kirupa.com/t/working-with-an-array/317253 "2010-12-14T23:35:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [December 14, 2010, 11:35pm UTC](https://forum.kirupa.com/t/working-with-an-array/317253/1 "2010-12-14T23:35:10Z")

</div>

i’m using the collision detection kit  
[http://www.coreyoneil.com/portfolio/index.php?project=5](http://www.coreyoneil.com/portfolio/index.php?project=5)

im using the CollisionList class.

it’s instantiated like this:

```auto
var collisions:CollisionList= new CollisionList(ship);//ship is added as the object to check collisions for.

```

then you add all the objects you want to check for collisions with the ship like…

```auto
collisions.addItem(rocks);

```

then later you make an array

```auto
 var collisionsArray:Array = collisions.checkCollisions();
            
                if(collisionsArray.length)
                    { 

                       doSomeStuff();
                        
                     }

```

i need a different response depending on wether the ship hits an upBumper, a leftBumper, a rightBumper, or a downBumper.

i have each in its own class but i don’t know about working with arrays.  
above I think i’m saying that if the Array collisionsArray has length(a collision has occurred so an object has been added to the array) then on we go to doSomeStuff(). Am i with it so far???

if yes then how could i do different things depending on the object that has been colided with…can i get the name as a string then if string equals…???
