Array syntax error or sheer impossibility?

ok, I got this doubt wich is kinda making me wonder for a while. :huh:

:block:**scenario: **
_I’ve got a movieclip with a bunch of buttons inside that invoke a function and send parameters to it. no sweat so far.
_those buttons are named with a specific word followed by “_btn”. that word is the same as the one that goes in the parameter. for example:

**gobbledigook**_btn.onRelease = function() {[INDENT]_root.myFunction(**gobbledigook**)
[/INDENT]}

:wt: question:
I’d like to be this work with a for loop, so I don’t have to repeat the code for every button. so this is what I did:

_root.wordsList = ["bafflegab", "esculent", "kakistocracy", "palimpsest", "quincux"]

for(i=0;i<_root.wordsList.length;i++){
    [_root.wordsList*+"_btn"].onRelease = function() {
        _root.myFunction(_root.wordsList*);
    }
}

now, I’ve searched for array syntax and all, but I can’t get this to work, so my question is becoming “can this be done at all?!” :ne:

answers, anyone?

Yes and no.


function mooCow():Void {
  trace("called moo!");
};

var fncList:Array = [mooCow];

btn.onRelease = fncList[0];

for(i=0;i<_root.wordsList.length;i++){
    _root[wordsList*+"_btn"].id = i;
    _root[wordsList*+"_btn"].onRelease = function() {
        _root.myFunction(_root.wordsList[this.id]);
    }
}