Copy link to clipboard
Copied
Hello,
I have defined a String array and would like to iterate through the entries:
var evArr: Array = new Array("empty", "ev1", "ev2", "ev3", "ev4", "ev5", "ev6", "ev7", "ev8", "ev9", "ev10", "ev11", "ev12", "ev13", "ev14", "ev15", "ev16", "ev17");
var countEvs:Number = 17;
var concatArray: String;
var i:Number;
for (i = 1; i <= countEvs; i++) {
concatArray= concatArray+ evArr[i];
}
textField.text = concatArray;
As a result I get:
"nulle1e2e3ee5e6e7eee1e11e12e13e1e15e16e17"
Does anyone know why are the "v"s removed? Why is there a problem with the numbers 4, 8, 9, 10, 14?
Thank you a lot in advace!
Hi.
You should initialize concatArray as "". Other than that, if you're not seeing those characters, the font family you're using is probably not embedded.
But if all you want to do is to display the items from the array, starting from the index 1, in a text field, I think it's eaiser to use some methods from the Array class. For example:
textField.text = evArr.slice(1).join("");
Regards,
JC
Copy link to clipboard
Copied
Hi.
You should initialize concatArray as "". Other than that, if you're not seeing those characters, the font family you're using is probably not embedded.
But if all you want to do is to display the items from the array, starting from the index 1, in a text field, I think it's eaiser to use some methods from the Array class. For example:
textField.text = evArr.slice(1).join("");
Regards,
JC
Copy link to clipboard
Copied
Hi,
Thanks for the tip regarding the font, it was indeed the reason. A different font worked!
Best regards
Copy link to clipboard
Copied
Nice! You're welcome.