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

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:


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();