# \[F8\] Array help (matching actions for 2 arrays)

**URL:** <https://forum.kirupa.com/t/f8-array-help-matching-actions-for-2-arrays/216462>\
**Category:** flash\
**Created:** [February 16, 2007, 6:36pm UTC](https://forum.kirupa.com/t/f8-array-help-matching-actions-for-2-arrays/216462 "2007-02-16T18:36:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CraigMayhem](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@CraigMayhem](https://forum.kirupa.com/u/CraigMayhem)\
**Post date:** [February 16, 2007, 6:36pm UTC](https://forum.kirupa.com/t/f8-array-help-matching-actions-for-2-arrays/216462/1 "2007-02-16T18:36:08Z")

</div>

Hey all…

I’m working on a mockup for a solution…

Got an array of button movie clips and an array of clips these buttons control. Got the button stuff worked out, but I need the buttons to control the corresponding movie clips…

I’m close, but on click the buttons all move the same clip, not the one they’re supposed to. I’ve attached the fla (explains it better)…

Here’s the codeActionScript Code:

ActionScript Code:

```auto

import mx.transitions.Tween;
import mx.transitions.easing.*;
//------------------------------------
function setArray() {
 for (var mc in squares) {
  squares[mc]._y = -100;
 }
}
//------------------------------------
var squares:Array = new Array(_root.squares.v1, _root.squares.v2, _root.squares.v3, _root.squares.v4, _root.squares.v5, _root.squares.v6, _root.squares.v7, _root.squares.v8, _root.squares.v9);
var buttons:Array = new Array(b1, b2, b3, b4, b5, b6, b7, b8, b9);
var tweenMethod = Back.easeInOut;
//------------------------------------
for (var a = 0; a<buttons.length; a++) {
 btn = buttons[a];
 btn.id = Number(a)+1;
 sqs = squares[a];
 sqs.id = Number(a)+1;
 btn.onRollOver = function() {
  new Tween(this.stinky, "_xscale", tweenMethod, 100, 150, .5, true);
  new Tween(this.stinky, "_yscale", tweenMethod, 100, 150, .5, true);
 };
 btn.onRollOut = function() {
  new Tween(this.stinky, "_xscale", tweenMethod, 150, 100, .5, true);
  new Tween(this.stinky, "_yscale", tweenMethod, 150, 100, .5, true);
 };
 btn.onRelease = function() {
  setArray();
  new Tween(sqs, "_y", tweenMethod, 0, 50, .5, true);
 };
}
//------------------------------------
stop();

```
