I can't say for certain, but it sounds to me like, sometimes, your 
creationComplete handler is firing before the RemoteObject returns data, 
thus firing the result handler.  Unless you have control over the 
Internet, I don't think there is any way to guarantee that your 
asynchronous code (AKA The result handler) will be finished before your 
synchronous code (creationCompete) is executed.

 You should handle your JavaScript stuff int he result handler of your 
RemoteObject, not in creationComplete.

Nitin Kanaskar wrote:
> hi All
>
> I am working on combo box data provider
> getting updated after call to a remote object which
> returns an array.  I am trying to update the data provider
> in a event handler for remote object. The problem is it sometimes gets
> updated and sometimes not - I read that remote object events
> are asynchronously handled. I am not exactly clear how -
> if at all - it affects my scenario.
>
> Here is my application init tag -
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute" preinitialize="getCPData()" height="90%" width="70%"
> backgroundColor="#FFFFFF" creationComplete="initApp();">
>
> My combo box is defined like -
>
> <mx:ComboBox width="100%" id="cpCombo" dataProvider="{cpCollection}"
> labelField="name" change="onCpChange()" prompt="--Select--"/>
>
> In getCPData() method during app preinitialization, I am creating
> remote object to
> get data from server side java component. For this remote object,
> an event handler - cpEventHandler - is invoked.
> cpEventHandler is updating data provider of the combo box -
>
> cpCollection = event.result as ArrayCollection;
>
> There are 2 scenarios - 1.in one, i dont need
> to select any option in the combo box, so prompt="--Select--"
> gives me 'Select' value default. 2. in 2nd, i need to set combo box
> to some selected index.
>
> In initApp method, which is called on app creationComplete, I am invoking
> a javascript component which passes few parameters back to a flex method,
> which tries to access data provider of the combo box. I suppose the combo
> box data provider should have been set by the time initApp is called as it is
> done in getCPData which is called on app preinitialize. But it happens
> sometimes,
> sometimes not which is frustrating.
>
> Can somebody throw light on this.
>
> Regards,
> Nitin
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location: 
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
>
>
>
>
>   

-- 
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl.com/684b5h
http://www.twitter.com/reboog711  | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras.com?c=104
--
http://www.theflexshow.com
http://www.jeffryhouser.com
--
Part of the DotComIt Brain Trust


Reply via email to