Correct use of eval in combination with array

Hi there,

its been a while since i used flash. Now and than i do small fun kind of things, ut im no hardcore coder. Im busy with a sort generatool which makes a code for a 3d application. I made a help section which i setup with about 25 buttons and a scroller with the help info inside which highlights these buttons, this parts works (finally…) i even added a dynamically moveable mask which moves according to the help info highlighted, it moves and scales by input of a array.

my next thing was to make the info number highlight the other way arround. So when hovering over a number the info in the scroller will be highlighted. I could do all 25 buttons manual, but i found could use in doing this with the eval function. I also dont want to do 25 buttons with all of there code and the masking etc etc.

here’s the code which i have so far. the buttons do highlight but on rollover they need to call a action and pass variables from a other array. the eval function doesnt do the second part or at least i cant get it to work.


var maskMov:Array = ["0,0,0,0","28,14,393,24","28,37,393,24","28,61,393,235","28,298,393,60","28,377,393,28","28,406,393,28","28,436,393,28","28,481,393,58","28,540,393,28","28,574,393,28","28,605,114,28","168,605,114,28","309,605,112,28","28,648,156,150","215,648,208,177","28,838,80,28","110,838,56,28","28,868,237,28","421,838,80,28","503,838,80,28","593,838,80,28","676,838,57,28","734,838,57,28"]
var infoItem:Array = ["infoItem0","infoItem1","infoItem2","infoItem3","infoItem4","infoItem5","infoItem6","infoItem7","infoItem8","infoItem9","infoItem10","infoItem11","infoItem11","infoItem12","infoItem13","infoItem14","infoItem15"];
var infoItemLength = infoItem.length;
var nrZw:Array = ["help1","help2","help3","help4","help5","help6","help7","help8","help9","help10","help11","help12","help13","help14","help15","help16","help17","help18","help19","help20","help21","help22","help23","help1i","help2i","help3i","help4i","help5i","help6i","help7i","help8i","help9i","help10i","help11i","help12i","help13i","help14i","help15i","help16i","help17i","help18i","help19i","help20i","help21i","help22i","help23i"];


k=0;for (k=0;k<infoItemLength;){
    var item=infoItem[k];
    
    eval(nrZw[k]).onRollOver = function(){ trace(item);rollOverItem(item,item2);    tocolor(this);}
    eval(nrZw[k]).onRollOut = function(){ rollOutItem(infoItem[k],maskMov[0]);    tozw(this);}
    ++k;
}
function rollOverItem(item,item2){
    helplistInfo.scroller.clipContainer.ySlideTo(20,.8,"easeOutExpo");
    helplistInfo.scroller.clipContainer[item].alphaTo(100,.5,"easeOutExpo");
    tocolor(helplistInfo.scroller.clipContainer[item].iconNummer);
    var maskM:String = item2;
    var arrAy:Array = maskM.split(",");
    for (i=0; i<4; i++){
        masker(arrAy[0],arrAy[1],arrAy[2],arrAy[3]);
    }
    //trace(helplistInfo.scroller.clipContainer[item].masker(item2))


}
function masker(a,b,c,d){
    this.mask.mask2.tween(["_x","_y","_width","_height"],[a,b,c,d],.5,"easeOutCubic");
}

Here’s the example file im making, the part im talking about is under the help button in the top right corner.

I hope its a bit clear what im asking. C&C are welcome

grtz Rombout