hey mike, i realized i was writing over the original array collection
shortly after posting- i am now just overwriting source like you suggested
and my listener is back, thanks!
d.
On Wed, Jun 11, 2008 at 10:07 AM, Michael Schmalle <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> Your wiping the reference to the original collection looks like.
>
> When you receive your data, try using removeAll(), addItem() or
> ICollectionView.
>
> OR
>
> set the 'source' property on the collection you added the listener to.
>
> Mike
>
>
> On Wed, Jun 11, 2008 at 9:56 AM, Derrick Anderson <
> [EMAIL PROTECTED]> wrote:
>
>> Hi, I'm using the Guasax framework in my application- and in my model
>> I am adding a collection change event listener, but it is never getting
>> fired- here is my code (is there something with adding event listeners in a
>> constructor maybe??)
>>
>> *EmployeesModel.as*
>> package com.winn.model
>> {
>> import com.winn.vo.EmployeeVO;
>>
>> import conf.Constants;
>>
>> import es.guasax.container.GuasaxContainer;
>> import es.guasax.view.ViewLocator;
>>
>> import mx.collections.ArrayCollection;
>> import mx.controls.Alert;
>> import mx.events.CollectionEvent;
>>
>> public class EmployeesModel
>> {
>> private static var instance:EmployeesModel;
>> public static function getInstance():EmployeesModel
>> {
>> if( instance==null ) instance = new EmployeesModel();
>> return instance;
>> }
>>
>> [Bindable] public var selectedEmployee:EmployeeVO;
>> [Bindable] public var employeesList:ArrayCollection;
>> [Bindable] public var employeeStatusList:ArrayCollection;
>>
>> public function EmployeesModel(){
>> employeesList = new ArrayCollection();
>> employeeStatusList = new ArrayCollection();
>>
>> *employeeStatusList.addEventListener (
>> CollectionEvent.COLLECTION_CHANGE,employeeStatusListChange );*
>> }
>>
>> * public function
>> employeeStatusListChange(event:CollectionEvent):void
>> {
>> Alert.show('firing listener function');//never shows
>> GuasaxContainer.getInstance().executeViewUpdate(
>>
>> [ViewLocator.getInstance().getViewObject(Constants.EMPLOYEES_VIEW)],
>> 'setEmployeeTypes',[]);
>> }*
>> }
>> }
>>
>> now here is where I load content into that arrayCollection and expect to
>> see my listener function fire off
>>
>> *EmployeeBO.as
>> private var employeesModel:EmployeesModel = EmployeesModel.getInstance();
>> *public function getEmployeesAuxData():void
>> {
>> var params:Array = [];
>>
>> ServiceLocator.getInstance().executeService("employeeCFC","getEmployeesAuxData",params,employeesAuxDataHandler,faultHandler,this);
>> }
>>
>> public function employeesAuxDataHandler(event:* = null ):void
>> {
>> *employeesModel.employeeStatusList =
>> event.result.EMPLOYEESTATUSES;//i assumed this would be enough to trigger
>> the collectionChange***
>> //employeesModel.employeeStatusList.refresh();*//thought
>> this would make the collectionEvent fire, but didn't*
>> employeesModel.employeeStatusList.dispatchEvent(new
>> CollectionEvent(CollectionEvent.COLLECTION_CHANGE));*//then tried to fire
>> it manually, but my listener is still never registered*
>> }
>>
>> can anybody see why it seems my event listener is never registered?
>>
>> thanks,
>> d.
>>
>>
>
>
> --
> Teoti Graphix, LLC
> http://www.teotigraphix.com
>
> Teoti Graphix Blog
> http://www.blog.teotigraphix.com
>
> You can find more by solving the problem then by 'asking the question'.
>
>