This content has been marked as final. Show 3 replies
This is because the variable, firstArray, holds a 'pointer' to the array and not the array data. So, the expression:
secondArray = firstArray
...sets up a new pointer to the same data.
You want to use a "copy firstArray into a new space and call it secondArray ."
A bit more detail; if you're using Boolean, String, int, uint or Number, when you assign one variable to another, it makes a true copy of the value. For other things, like arrays, custom objects, objects, etc. it is, as gsb said, simply a pointer or reference to the original object so anything you do to the 'copy' actually acts on the original. Look up 'cloning arrays' in Flex help.
"SiHoop" <firstname.lastname@example.org> wrote in message
> The following code traces:
> How is it possible for the value of the array firstArray to change?
Because firstArray and secondArray are the same thing. If you read the
Array documentation, this is spelled out VERY clearly.