0

How can I add an element to object in arraycollection?

Example code:

var mycollection:ArrayCollection = new ArrayCollection();
var myobject:Object=new Object();
myobject["label"]="My Label";
myobject["data"]="My data";
mycollection.addItem(myobject);

If later on, I want to add extra element, let say "date" to myobject in mycollection, how can I do it?

Thank you.

1 Answer 1

1

My experience is with Flex more than Flash...

If you still have the reference to myobject, it is as simple as:

myobject["date"]= new Date();

If you want to trigger viewers of the collection to update their views of the collection, you would also likely have to do:

mycollection.itemUpdated(myobject, "date", null, myobject["date"]);

Cheers, Terry

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

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.