I have got a VO called personVO that have got firstname and
Then I have an array that contains the personVO.
In my interface it is then possible to select a personVO.
The selected personVO would I like to have in the variable
How do I do that?
First I thought about copying the selected personVO into
selectedPerson. But I do not want to have another copy of the
values because they are already in the array.
Then I thought about making the selectedPerson to some kind
of pointer, pointing into the array.
But I do not want the selectedPerson to have an index value
to the selected personVO. I want the selectedPerson to point
directly to the VO.
I would be able to call the selected persons firstname like
You might want to think about using an ArrayCollection rather
then an Array. You can then implement Bookmarking and Cursors to
get the effects you want directly off the ArrayCollection. It also
has added value in that any control that makes use of the
arraycollection as it's dataprovider auto update as items in the
array are modified.
yes, use arrayCollection if you plan to programatically
update the VO, as you clearly plan.
In almost all cases, assigning a complex object to a variable
creates a reference/pointer to the original object. So if you do:
var voSelectedPerson:personVO = acPersons.getitemAt(0);
you have a reference into the item in the collection not a
voSelectedPreson.firstname = "joe";
puts that value into the correct item in the collection.