look at this mx.events.CollectionEventKind

--- In flexcoders@yahoogroups.com, "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,fa
ultHandler,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.
>


Reply via email to