dimanche 5 mars 2017

AS3 Accessing Array Name Through For Loop with counters?

I do not know what you would call or define this type of issue with AS3. I have 2 For Loops that look like this:

// Here I would have 5 arrays naming from NDW1 to NDW5
var NDW1:Array = new Array();

for(var a:int = 1; a < 6; a++){
    for(var b:int = 0; b < 14; b++){
       // Here I want to call a function and assign it to a textfield
       this["DifferenceW"+a+"_"+b].text = CalculateDifference(Number("NDW"+a+"["+b+"]"), Number("NDW"+a+"["+b+"]")).toString();
    }
}

My problem that I am having is trying to access the actual array of NDW while using counters to increment that actual array and array element. But when I type "NDW"+a+"["+b+"]" it will only return a string value. How do I actually get it to return the array with that current element? So for example if NDW1[0] = 2 instead of just a string of NDW1[0]?

Aucun commentaire:

Enregistrer un commentaire