Hi Corey,
Seems strange to me too, it should listen.
I tried to do the same, but a little simple, and it is working correct.
*CUSTOM ARRAYCOLLECTION*
package as3
{
import mx.collections.ArrayCollection;
import mx.events.CollectionEvent;
public class MyAC extends ArrayCollection
{
public function MyAC(source:Array=null)
{
super(source);
}
public function getData():void
{
for (var i:uint=0; i<10; i++)
{
this.addItem("Item"+i.toString());
}
this.dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
}
}
}
*CONSUMING APPLICATION*
*
*
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="onCre()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.CollectionEvent;
import as3.MyAC;
private function onCre():void
{
var myAc:MyAC = new MyAC();
myAc.addEventListener(CollectionEvent.COLLECTION_CHANGE,myACChangeHandler);
myAc.getData();
}
private function myACChangeHandler(evt:CollectionEvent):void
{
Alert.show("I am here",evt.currentTarget.length);
}
]]>
</mx:Script>
</mx:Application>
I am able to listen the event here, and I am able to listen it 10 times.
Coming to your class:
public class HostGroups extends baseCollection
what is baseCollection here ?
public override function copy(jsonObject:Object):void{
I believe the base copy function will be in baseCollection class ? what it
is for ?
you can trace, if the control comes under the copy function ?
you can also add a listener inside the HostGroup may be in a constructor to
see if you can even listen the event inside the same class, if it is by any
means a bubble issue.
Let me know, if you find anything.
On Sat, Aug 27, 2011 at 8:48 PM, Corey Osman <[email protected]> wrote:
> HI,
>
> I have an issue where when I dispatch an event from an extended
> arraycollection class the resulting event never gets caught.
>
> I dispatch the event from a arraycollection based class and then listen for
> the event in a controller that instantiated the class. However, the event
> never seems to get caught. Can anybody help me with this? Events are not
> new to me but I can't seem to get this specific instance to work. Is there
> a way to "monitor" the event stream? I have spent 4 hours trying to figure
> that out and can't solve this problem.
>
>
> Code snippets
> http://pastebin.com/1nXmCCQn
>
>
> Corey
>
>
> -------------------------------------------------------------
> To unsubscribe from this list, simply email the list with unsubscribe in
> the subject line
>
> For more info, see http://www.affug.com
> Archive @ http://www.mail-archive.com/discussion%40affug.com/
> List hosted by http://www.fusionlink.com
> -------------------------------------------------------------
>
>
>
--
Thanks,
Vaibhav Seth.