No, sorry, there is NO code blocking in AS/Flex.  You MUST do the work in
result handler.  Resistance is futile.

 

It takes some getting used to but with a bit of thought, driven by
necessity, you will find a way to re-arrange your functionality to work
within the asynchronous, non-blocking paradigm.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of Angelo Anolin
Sent: Wednesday, August 26, 2009 2:03 AM
To: [email protected]
Subject: [flexcoders] Question on Flex Script Execution + Alert.show

 

  

Hi FlexCoders,

This has puzzled me a bit..

I have the following scripts in my application:

private var myAlert:int;

private function testFunction(evt:Event):void
{
  Alert.show('do you want to proceed', 'Title', Alert.YES | Alert.NO, null,
alertHandler, null, Alert.YES);

  if(myAlert == 1)
  {
    // Do Something here
  }
  else
  {
    // Do other thing here
  }
}

Private function alertHandler(evt:CloseEvent)
{
  if(evt.Detail == Alert.YES)
  {
    myAlert = 1;
  }
  else
  {
    myAlert = -1;
  }
}

Now, what puzzles me is that the script after the Alert.show is triggered,
the scripts following it are also triggered.

Is there a way to ensure that the script following the Alert.show alert box
would only be executed after the Yes or No buttons has been pressed?

I won't be able to move the scripts after the Alert.show script to the
alertHandler event since there are some objects being set / modified prior
to the alert being called.

Inputs highly appreciated.

Thanks.

 



Reply via email to