# If else trouble AS2/CS4

**URL:** <https://forum.kirupa.com/t/if-else-trouble-as2-cs4/289414>\
**Category:** Uncategorized\
**Created:** [May 29, 2009, 10:52pm UTC](https://forum.kirupa.com/t/if-else-trouble-as2-cs4/289414 "2009-05-29T22:52:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloudiness](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cloudiness](https://forum.kirupa.com/u/cloudiness)\
**Post date:** [May 29, 2009, 10:52pm UTC](https://forum.kirupa.com/t/if-else-trouble-as2-cs4/289414/1 "2009-05-29T22:52:59Z")

</div>

hello,

I have a for loop attaching movies to my stage, the way I want to arrange them is for 4 to load horizontally, then 4 underneath. then once those two rows of 4 are full to start over right next to it.

here’s what I have so far:

```auto

    if(currMovie._x>250 && currMovie._y>150){
        xPos += currMovie._width+5
        yPos = photo0;
//this is supposed to see if both rows are full
    }
    else if(currMovie._x > 250){
    yPos += currMovie._height+5;
    xPos = photo0._x;
//this puts the 5th image under the first
    }

        else{
        xPos += currMovie._width+5
//this puts the image next to the one before it if the row is still less than 4
    }

```

The problem I see is in if statement:  
if(currMovie.\_x\>250 && currMovie.\_y\>150)  
how can I write in this way:  
if(currMovie.\_x\>(first image in this row.\_x+250) && currMovie.\_y\>150)

anyone have any ideas?  
hope someone can help me out!
