Apply event.prevent default always, store any necessary information in a
model, then in the result handler, update the dataProvider or not.

 

Sure, there are always trade-offs.  You could develop in C++ and you would
not have this problem.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Angelo Anolin
Sent: Thursday, August 27, 2009 4:51 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex Function and Web Service ResultHandler
Question

 

  

Hi Tracy,

Thanks for the insight.

I think this is one big hurdle (and one which would prevent some developers
from embracing Flex).

I am already getting used to Flex, but only for those which comprises of
only single transactional call to the database.

I still can't think of a way like to get through this:

myFunction(evt:dragDrop)
{
  // Check if data passes validation.  If not, confirm from user if proceed
  Alert.show('Proceed?', '', Alert.Yes | Alert.No, alertHandler);
  
  // If Yes was pressed, then should do something here, else call the
preventDefault
}


But since after the alert, the conditional script is executed on the alert
Handler event, how would I be able to reference or make a call for
evt.preventDefault which is only visible in the myFunction?

*Sigh*

I need to get over / hurdle this... 

Regards,

Angelo

  _____  

From: Tracy Spratt <tr...@nts3rd.com>
To: flexcoders@yahoogroups.com
Sent: Thursday, 27 August, 2009 14:45:16
Subject: RE: [flexcoders] Flex Function and Web Service ResultHandler
Question

  

It is simply a different way of thinking.  Whatever you need to do, you can
do within the constraints of the async/non-blocking coding paradigm.

 

This is a hurdle that almost all new Flex developers must get over.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On
Behalf Of Angelo Anolin
Sent: Wednesday, August 26, 2009 10:09 AM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] Flex Function and Web Service ResultHandler
Question

 

  

Hi Tracy,

You mentioned that this is the only way...

But doesn't this kind of programming limits what the developer could
actually do?

I mean for example, you have coded in the dragDrop event of a list control.
In the said event, you need to get some data through a web service.  The
whole operation is dependent on the event handler for the dragdrop.  If you
would only be allowed to process the operations further in the result
handler of the web service, how could you then utilize the event which was
the parameter in your dragdrop event?

I think this question also goes the same for the Alert.show function where
the result handler deviates from the function/event with which it was
executed.  If the continuation of execution would be on the Alert handler,
it would be quite tedious on the part of the developer to be able to gather
the variables/objects/ handlers from the original function/event.

I am pretty sure Adobe / Flex team has thought about this but I may be doing
things wrong.  So I would appreciate everyone's input.  I am in a bind right
now cause this limitation(? ) hampers me from being a lot more productive
with Flex.

Thanks.

Angelo

 

  _____  

From: Tracy Spratt <tr...@nts3rd. com>
To: flexcod...@yahoogro ups.com
Sent: Wednesday, 26 August, 2009 12:55:18
Subject: RE: [flexcoders] Flex Function and Web Service ResultHandler
Question

  

You will have to initiate your "further operations" from the result handler.
There is no other way.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On
Behalf Of Angelo Anolin
Sent: Tuesday, August 25, 2009 9:54 PM
To: flexcod...@yahoogro ups.com
Subject: [flexcoders] Flex Function and Web Service ResultHandler Question

 

  

Hi FlexCoders,

 

Needing your input on the following:

 

I have created a function for the dragevent of a list.

 

Code is as follows:

 

private function myFunction(evt: DragEvent) :void
{
 var nameID:String = 'Angelo';
 
 // Call a webservice operation here
 ws.GetStatus( nameID);
 
 Alert.show(String( _xmlGetStatus) , 'myFunction' );
 
 // I need to use the _xmlGetStatus here...
 // But the _xmlGetStatus is NULL?
 // Although in the Result Handler, it is not NULL.
}

 

private function getStatusResultHand ler(event: ResultEvent) :void
{
 _xmlGetStatus = XML(event.result) ;
 Alert.show(String( _xmlGetStatus) , 'getStatusResultHan dler');
}

 

The result handler for the GetStatus web service operation populates an XML
variable which I declared on top of the script (i.e. private var
_xmlGetStatus: XML;).

 

When I run my application, myFunction executes but the alert that is shown
first is the one in the function myFunction, instead of the one in the
result handler.

 

I need to use the values in the XML variable _xmlGetStatus for further
operations in function myFunction, but then the value is not populated right
away.

 

Any way to handle this?

 

Thanks and regards,

Angelo

 

 

 



Reply via email to