Dynamic MovieClip Events

Hi all,

I’ve been trying to create a vertical navigation bar. Each button on the bar is dynamically created by the fadeRecsIn() function. Each button is also populated with a text field that populates from the Array of strings “t”.

I need to be able to make each button do something different upon being clicked on. I think my code below explains it pretty well.

var clips:Array = new Array();

function fadeRecsIn() {
for (var i:uint; i<t.length; i++) {
var br:BlueRec = new BlueRec();
var tf:TextField = new TextField();
tf.text = t*;
br.x = 0;
br.y = i53;
//Fade buttons in and down
var brtween:Tween = new Tween(br,“alpha”,Regular.easeIn,0,1,1,true);
var brYtween:Tween = new Tween(br,“y”,Regular.easeIn,br.y-100,i
53,1,true);
//add br Movieclip to stage
br.addChild(tf);
//set buttonMode to true
br.buttonMode = true;
//populate clips array with new movieclip instance
clips.push(br);
addChild(br);
}
}
//call function
fadeRecsIn();

//assign event listener for MOUSE_UP to each instance in the clips array.
for (var i:uint=0; i<clips.length; i++) {
clips*.addEventListener(MouseEvent.MOUSE_UP,onReleaseHandler);
}

function onReleaseHandler(e:MouseEvent) {
//I think this is where the problem is.
//move the movieclip that was clicked on 20 pixels to right.
this.x += 20
}

Let me know if you need any more information and thanks very much for your time!!!