But if your array is a dataProvider and
you WANT to update the control as you go, do use additem() or addItemAt(). Though usually, if you are building an
entire dataProvider, you want to wait until you are done, then re-assign the array
to the dataProvider. Tracy From: Doing this: testArray[0] within the loop will always
insert the value in the 0 slot of the array, so your loop is pointless.
Use the num variable to increase the array postion targeted. Also,
addItem is not necessary. To get the expected results, do this: var testArray:Array = new Array(); var temp_arr:Array = new
Array();
for(var num:Number = 0; num < 3; num++) {
temp_arr[num] = num; testArray[num] =
num+5;
}
trace(temp_arr) trace(testArray) Jason
Merrill | E-Learning Solutions |
icfconsulting.com
From: Hi, I have a piece of code like the following:
var testArray:Array = new Array(); I am expecting it to print instead the it prints out Can anybody tell me why??? How can I fix it? Thanks,
NOTICE: This
message is for the designated recipient only and may contain privileged or
confidential information. If you have received it in error, please notify the
sender immediately and delete the original. Any other use of this e-mail
by you is prohibited.
|
Title: problem with arrays
- RE: [flexcoders] problem with arrays Tracy Spratt
- RE: [flexcoders] problem with arrays Merrill, Jason