Help with transfering values from one array to another

Defenition of products array in Script 1 (exportScript)

var products = new ExportInventory[3];

Defenition of goodsList in Script 2 (G)

static var goodsList = new Dictionary.<int,Goods>();

Script 3, where the problem is

var i : int = 0;
for(p in G.goodsList.Values){
 exportScript.products*.goodId = p.goodId;*

i++;
}
Can anyone tell me why all exportScript.products_.goodId entries gets set to the last value in the G.goodsList.Values_
p.goodId is different on each step in the loop as it should.

How have you populated exportScript.products? Is it possible that all of the exportScrip.products[?] objects refer to the same object? hence each time you’re setting goodId you’re setting it on the same object over and over?