function does not works with array in following code:
in reference image these five are the movieclips on the stage and their instance names are same as the array items. see attachment for reference.

Code:
var mainBtnsArr:Array = ["chapters", "projects", "exercises", "skills", "glossary"]; for (i=0; i<mainBtnsArr.length; i++) { mainBtn = mainBtnsArr[i]; mainBtnsArr[i].onPress = function() { trace("working"); }
Any help please?