Assigned numbers to movie clip to plug in formula... not working

Posted by Matthew MlgPro Harding on Stack Overflow See other posts from Stack Overflow or by Matthew MlgPro Harding
Published on 2012-11-13T16:47:10Z Indexed on 2012/11/13 17:00 UTC
Read the original article Hit count: 287

So I am attempting to vertically evenly space these movie clips so I came up with a math formula involving n( the button number) but Its not working.

var buttonArray:Array = [ side_banner.btn1, side_banner.btn2, side_banner.btn3, side_banner.btn4];

var buttonCount:uint = buttonArray.length;

for (var i:uint=0; i< buttonCount; i++) {
buttonArray[i].addEventListener(MouseEvent.CLICK, outputNumber);
buttonArray[i].theTrigger = [i + 1];
}

function outputNumber(e:MouseEvent):void {
trace( e.target.theTrigger);
buttonArray[i].y = (((stage.stageHeight - 400)/4)*(e.target.theTrigger)) - ((stage.stageHeight - 400)/4)/2
}

But apparently each movie clip doesn't actually have a numerical value just a numeric name... how can I get the "n" btn number to use my formula?

Thanks

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flash