# Need help with a voting project

**URL:** <https://forum.kirupa.com/t/need-help-with-a-voting-project/254643>\
**Category:** Uncategorized\
**Created:** [March 13, 2008, 8:05pm UTC](https://forum.kirupa.com/t/need-help-with-a-voting-project/254643 "2008-03-13T20:05:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xstevenx](https://avatars.discourse-cdn.com/v4/letter/x/4491bb/32.png) [@xstevenx](https://forum.kirupa.com/u/xstevenx)\
**Post date:** [March 13, 2008, 8:05pm UTC](https://forum.kirupa.com/t/need-help-with-a-voting-project/254643/1 "2008-03-13T20:05:46Z")

</div>

I’m working on this project where I give the user 12 options and they can choose 6 to vote on and then submit their choices. I had a little help and this is the code I have now:

```auto
var resultArray:Array = [];
var totalPressed:Number = 0;

for (i=0;i<12;i++) {
    this.attachMovie("box","box"+i,this.getNextHighestDepth(),{_x:30,_y:10+(30*i)})
    this["box"+i].id = i;
    this["box"+i].onRelease = function() {
        judgeAmount(this,this.id);
    };
    resultArray.push(-1);
};

function judgeAmount(box:MovieClip,idNo:Number):Void {
    if (box._currentframe == 2) {
        totalPressed--;
        resultArray[idNo] = -1;
        box.gotoAndStop(1);
    }
    else {
        if (totalPressed < 6) {
            box.gotoAndStop(2);
            resultArray[idNo] = 1;
            totalPressed++;
        }
    };
    if (totalPressed == 6) submit._alpha = 100;
    else submit._alpha = 0
};

```

Now this works great, but the problem is that it’s generating the boxes from the library and I want the code to point to boxes already on the stage. I know the problem has to with the “for” statement, but I’m not sure how to change it. If anyone has any help they could give I would really appreciate it. Thank you!
