PDA

View Full Version : Combining two ArrayCollections


tazboy
08-16-2008, 02:11 PM
Here's what I tried:

[Bindable]
public var WrAC:ArrayCollection = new ArrayCollection(
[ {label:"Dude"},]);

[Bindable]
public var WrRbAC:ArrayCollection = new ArrayCollection();

WrRbAC.source = WrRbAC.source.concat(WrAC.source);

I get this error:

1120: Access of undefined property WrAC.

Any ideas of suggestions would be appreciated. Thanks.

tazboy
08-16-2008, 03:13 PM
Heck even this gives me the same error:

[Bindable]
public var WrRbAC:ArrayCollection;

WrRbAC = new ArrayCollection();

Am I missing something? Do array collections behave differently from other variables?

Sly_cardinal
08-17-2008, 11:11 AM
Where does this code sit in your source file? Is it an Actionscript file or an mxml file?

Make sure your non-initialisation code sits inside a function:

[Bindable]
public var WrAC:ArrayCollection = new ArrayCollection(
[ {label:"Dude"},]);

[Bindable]
public var WrRbAC:ArrayCollection = new ArrayCollection();

public function functionDefinition():void
{
WrRbAC.source = WrRbAC.source.concat(WrAC.source);
}