Get data from array in Number format
Ive got this array with numbers in it, which i want to use for some simple calculations, but i keep getting the message that the array data isnt a number:
The whole is in a for loop, with teller1 as increasing value.
the code:
var xco:Array = [180,233,271,292,292,270,231,179,124,74,34,11,9,30,70,121];
var yco:Array = [11,33,73,124,181,232,270,290,291,271,234,183,125,72,33,11];for(var teller1=1; teller1<33; teller1++) {
var ringsegment_mc:Ring_1=new Ring_1();
ringsegment_mc.x=xco[teller1]+kernplaats;
ringsegment_mc.y=yco[teller1]+kernplaats;
ringsegment_mc.addEventListener(Event.ENTER_FRAME,vernietig);
addChild(ringsegment_mc);
switch(teller1) {
case 16:
//kernplaats=Math.random()*600+300;
kernplaats=Number(400);
trace (yco[teller1]);
trace (yco[teller1]+kernplaats);
}
}
so the trace functions give:
undefined
NaN
so i tried using this:
trace (yco[3]);
trace (yco[3]+kernplaats);
which gave this:
124
524
so something is going wrong when trying to read the array, but what? and how can it be fixed/