Binding around variables when a simple 'wait for completion' call would have 
done, is just an annoyance.  I know that a multitude of events can serve to 
solve this.

IMO however, the lack of thread control does make the transition from compiled 
languages annoying. These little nitpicks just teeter Flex toward the "platform 
for designers" camp for me, vs. one truly oriented at programmers.  It's a 
pretty nice Breeze movie on the Adobe site about RIA and "taking back what we 
had with Client/Server apps"; this is definitely a truncation of that motus.

Potential network failures though..  they already have a 'timeout' value on 
HTTPService, that's all that needed to be leveraged.  Fail with a timeout event 
that we can implement.

Look at dojo for example

dojo.io.bind{
   url: http://blabla/post.php
   timeoutSeconds: 10
   timeout: function(){
 
   }
}

Either way,  maybe Adobe will add it in when someone at Laszlo does ;)  I won't 
beat an already well-beaten horse!  

This aside, I am having fun with Flex :)

Cheers.
Alex


  ----- Original Message ----- 
  From: Tracy Spratt 
  To: [email protected] 
  Sent: Tuesday, March 13, 2007 6:41 PM
  Subject: RE: [flexcoders] Synchronous HTTPService possible? Need to verify 
edit inside of Edit Event..



  It is most definitely not an "oversight"!  Folks have been fussing about it 
since the beta, but it was a conscious decision, based, I'm sure on potential 
network failure scenarios.  None of the RPC protocols permit synchronous calls.



  In a similar vein, be aware that there is NO code blocking in 
Flex/FlashPlayer.  "Modal" dialogs and Alert.show() are not truly modal, 
processing runs to the end of the function.  You cannot use loops or timers or 
whatever. You must use events to handle this kind of functionality.



  Resistance is futile.



  Tracy




------------------------------------------------------------------------------

  From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Lex
  Sent: Tuesday, March 13, 2007 4:34 PM
  To: [email protected]
  Subject: Re: [flexcoders] Synchronous HTTPService possible? Need to verify 
edit inside of Edit Event..



  Hi Shaun,



      Thanks for the note, I had found a workaround. It's too bad nonetheless, 
this seems a pretty serious oversight on Adobe's behalf.  Every other framework 
I've ever worked with, include simple browser XHOR can be made to permit sync 
requests.. Onto the next stumbling block!



  Cheers.

  Alex







    ----- Original Message ----- 

    From: shaun 

    To: [email protected] 

    Sent: Tuesday, March 13, 2007 5:03 PM

    Subject: Re: [flexcoders] Synchronous HTTPService possible? Need to verify 
edit inside of Edit Event..



    Hi,

    Alex wrote:
    > Quick question,
    > 
    > 
    > I'm trying to devise a table-edit view of a set of database tables,
    > and am successfully pulling records using e4x etc.
    > 
    > At the cell-edition stage, I'm capturing an "itemEditEnd" event on my
    > DataGrid, and that's going well also.
    > 
    > My question however, surrounds actual edition, and the cancellation of
    > an edit event.
    > 
    > The code should look like this:
    > 
    > private function editHandler( e:DataGRidEvent ):void{
    > if( e.reason == DataGridEventReason.CANCELLED )
    > return;
    > 
    > // get the new input
    > var newData:String = TextInput(
    > e.currentTarget.itemEditorInstance).text;
    > 
    > // request the edit
    > ??
    > 
    > if( "edit was bad" ){
    > e.preventDefault();
    > // TextInput( dataGrid.itemEditorInstance ).errorString = "Invalid
    > input";
    > }
    > }
    > 
    > 
    > "Requesting the edit" above, involves using HTTPService to send the edit
    > request to the server, which will respond with OK, or NOT OK. How can I
    > "wait" for an HTTPService request inside of that function, so that I can
    > call e.preventDefault() if required? AFAIK, the HTTPService only works
    > with a callback-type model?
    > 
    > Can I synchronize and wait on a lock like in Java in this case?
    > 

    No, I dont think you can do it like that.

    How about moving the "if (edit is bad)" check to the result handler of 
    the http service. Then depending on whether you prevented the default 
    event from happening or not in the itemEditEnd handler, update the value 
    accordingly.

    It might look something like this:

    get the original value from the model.
    get the new value from the model.
    dispatch the validation http service event with the old and new value
    on result of the validation event
    if the result is NOT OK then
    set the data in the model back to the old value
    set the error message
    end if
    end on result

    I guess, depending on your architecture, you could just move your
    if("edit was bad" ){ } code into another method and have the component 
    implement the IResponder interface to invoke that method when the 
    validation service is done.

    Then again, there are validation classes that are probably the best 
    place to do this rather than the itemEditEnd event handler - not sure.

    HTH.

    cheerio,
    shaun



   

Reply via email to