There are two ways you come out of thsi problem: 1) No need to make new properties simply use model.listUsers; as your dataprovider and model.countUsers to display count of users. 2) Make these properties as class variables and make them bindable and than assign refernce of modellocator properties to properties that you have declared at class level on creation complete.
--- In [email protected], "txakin" <txa...@...> wrote: > > Hi guys, > > I'm developing an application with Flex and using Cairngorm framework with > the events, commands, controller, delegates and the services for the remote > object, because my application will connect with a server side. > > My component is like that: > > <mx:VDividedBox xmlns:mx="http://www.adobe.com/2006/mxml" > creationComplete="initView()" width="100%"> > > The initView method will execute a CairngormEvent to access to the database > and get all the users from my system and how many users i have: > > [Bindable] > public var model:ModelLocator = ModelLocator.getInstance(); > > private function initView():void{ > //Find all the Users in the database > var findAllUsersEvent:FindAllUsersEvent = > new FindAllUsersEvent(); > > findAllUsersEvent.dispatch(); > var listUsers:ArrayCollection = model.listUsers; > var totalRows:int = model.countUsers; > } > > Of course in my ModelLocator i have created the next properties: > > public var listUsers:ArrayCollection > public var countUsers:int; > > In my command i call the method from the delegate to execute the correct > method of the remote object (it means of my java application running in the > server). > > In the result method of the command, i assign the value of each properties. > > If i debug the application, i get the correct results, but when i check the > value of > > var listUsers:ArrayCollection = model.listUsers; > var totalRows:int = model.countUsers; > > are not refreshed. > I can imagine my problem is because Flex is asyncronous and when i assign the > values in the initView, maybe the Event is not yet finished. > > How can i handle this kind of problem? > I hope all of you have understood me... > > Thanks in advance!!!!!! >

