You could bind a setter, something like this (written in gmail, this was not
compiled):

private var array:Array;
private var arrayCollection:ArrayCollection;

public function ClassName(..args) {     //Constructor
   array = new Array();
   BindingUtils.bindSetter(setArrayCollection, this, array);
}

private function setArrayCollection(array:Array):void {
   arrayCollection = new ArrayCollection(array);
}

This will cause the setter function to run everytime array changes. But do
some reading on when Array does and does not dispatch a change event...

HTH
Sefi


On Tue, Aug 26, 2008 at 7:58 PM, Battershall, Jeff <
[EMAIL PROTECTED]> wrote:

>   Your approach to the problem doesn't appear to be correct. Some
> additional code would be helpful.
>
> Jeff
>
>
> -----Original Message-----
> From: [email protected] <flexcoders%40yahoogroups.com> [mailto:
> [email protected] <flexcoders%40yahoogroups.com>] On
> Behalf Of flexaustin
> Sent: Tuesday, August 26, 2008 11:17 AM
> To: [email protected] <flexcoders%40yahoogroups.com>
> Subject: [flexcoders] ArrayCollection bound to an Array.
>
> Is it possible to bind an ArrayCOllection to an array, like so
>
> public var summDataForControllers:Array = new Array;
>
> public var _summDataForContrAC:ArrayCollection = new
> ArrayCollection({summDataForControllers});
>
> I have a modelLocator that contains these to items (above) and I want a
> component to bind to the arrayCollection. I am storing the information
> in the array first because when I try to update the arraycollection from
> my component and then access a certain item in the arraycollection I get
> Index 0 out of bounds. So in other words I iterate and say
> arrayCollection.addItemAt(i) then try
> arrayCOllection.getItemAt(i) I get the out of bounds issue.
>
> But if I iterate and store the information in an array everything is
> fine, but now my component can't listen for updates, which is the reason
> I am trying to bind my arraycollection to the array.
>
> Thanks in advance for any help.
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>  
>

Reply via email to