0

Doing something wrong with this:

I have four arrays holding data:

      id_array:Array;
      last_name_array:Array;
      first_name_array:Array;
      condition_array:Array;

I have a for loop with counter set to the number of items in the arrays, with the idea of inserting data from each array into the fields of the following DiffArray. I am getting Error #1009: Cannot access a property or method of a null object reference and I cant see why.

    for(var i:Number=0; i<Student_counter; i++){
    DiffArray.push({id:id_array[i],first_name:first_name_array[i],last_name:last_name_array[i],condition:condition_array[i]});
    }

Help with this greatly appreciated.

3 Answers 3

1

You have to declare your array first : DiffArray:Array = new Array();

Sign up to request clarification or add additional context in comments.

1 Comment

How silly of me, thank you, that sorted it. Too many hours working when I should be enjoying st Patrick's day!
0

DiffArray should be initialized first.

Comments

0

I assume you're making sure your 4 arrays are all the same length, or at least (Student_counter) long ?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.