I'm getting really confused here!

This is what's happening...

I have an arrayCollection on the 'model' and also an arrayCollection 
in a local function (the result function in a 'command' module which 
is fired on return from a web service).

So I'm using this local arrayCollection to build up the one on the 
model.

However...

model.globalAC.addItem(localAC);

will add an item on the model AC but if I then do this:

localAC.removeAll();

Not only does localAC get cleared down - so does the item on 
globalAC!

So if I do this:

model.globalAC.addItem(localAC);
model.globalAC.addItem(localAC);

I get two elements created in globalAC... again the localAC.removeAll
() clears down not just localAC but both elements on the globalAC!

So it seems that when I do the 'addItem', I'm actually adding a 
reference to localAC to globalAC. How can I not do this - I want a 
copy of localAC created in globalAC[].

Also, localAC is defined locally. How is it then, that another 
component that uses model, can see the contents of localAC via the 
reference in globalAC ? Isn't localAC destroyed when the local 
function is exited ?

Again, thanks for any insight/help anyone can offer!

Cheers,

Jamie.

Reply via email to