# Value from multiple array

**URL:** <https://forum.kirupa.com/t/value-from-multiple-array/257179>\
**Category:** flash\
**Created:** [April 10, 2008, 10:40pm UTC](https://forum.kirupa.com/t/value-from-multiple-array/257179 "2008-04-10T22:40:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![youwh](https://avatars.discourse-cdn.com/v4/letter/y/82dd89/32.png) [@youwh](https://forum.kirupa.com/u/youwh)\
**Post date:** [April 10, 2008, 10:40pm UTC](https://forum.kirupa.com/t/value-from-multiple-array/257179/1 "2008-04-10T22:40:15Z")

</div>

I have 2 set of array. I wanted when at **bug1** , one of the value in the code run \*1 \*from the buttons array, **bug2** it runs _2_ from the points array…

This is the AS code.  
ActionScript Code:  
[FONT=Courier New][LEFT]for (var a = 0; a\<points.length; a++) {  
pnt = points[a];  
pnt.id = Number(a)+1;  
}

for (var a = 0; a\<buttons.length; a++) {  
btn = buttons[a];  
btn.id = Number(a)+1;

```
btn.onPress = function() {
    this.startDrag();
    trace("Button "+this.id+" = Press");
};
btn.onRelease = function() {
    this.stopDrag();
    if ((eval(this._droptarget) == area) && (areaX == "on")) {
        _root.totalAmount = _root.totalAmount+point5;
        this._x = target._x;
        this._y = target._y;
        this.count = "yes";
        areaX = "off";
        trace("Button "+this.id+" = Release");
    } else if ((eval(this._droptarget) == area) && (this.count == "yes")) {
        this.count = "no";
        areaX = "on";
    } else if ((eval(this._droptarget) == bg_remove) && (this.count == "yes")) {
        _root.totalAmount = _root.totalAmount-point5;
        this.gotoAndPlay(2);
        dupBug(this);
        this.count = "no";
        areaX = "on";
    } else if ((eval(this._droptarget) == bg_remove) && (this.count == "no")) {
        this.gotoAndPlay(2);
        dupBug(this);
    } else {
        this.gotoAndPlay(2);
        dupBug(this);
    }
};

```

}  
[/LEFT]  
[/FONT]

And this is where i wanted to load in the value according to the _buttons_ array.

```auto

_root.[COLOR=#000080]totalAmount[/COLOR]+ **point5** ;
_root.[COLOR=#000080]totalAmount[/COLOR]- **point5** ;

```

How should I write the code? Thanx for any help!
