[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 860
  • Last Modified:

From a actionscript function in flex, how do I get the UI to update like it would if I called DoEvents in VB?

I have a function in my flex app that produces a pdf.   Producing the pdf can take a few seconds, I'd like to display a popup for the user to let them know they need to wait, so at the top of my function I use CursorManager and PopUpManager to inform the user, but the dialog is never displayed because control never passes back to the ui.

In VB, this problem is easily worked around by a call to "DoEvents".

How do I work around this problem in actionscript?
CursorManager.setBusyCursor()
dlgPleaseWait = PopUpManager.createPopUp(this, PleaseWait, true) as PleaseWait;
PopUpManager.centerPopUp(dlgPleaseWait);

Open in new window

0
Drachs
Asked:
Drachs
1 Solution
 
Gary BenadeCommented:
function makePDF( fn:String):void
{
  makePDF();   // do the hard work here
  PopUpManager.removePopUp(dlgPleaseWait);
  CursorManager.removeBusyCursor()
}


function onClick():void
{
  CursorManager.setBusyCursor()
  dlgPleaseWait = PopUpManager.createPopUp(this, PleaseWait, true) as PleaseWait;
  PopUpManager.centerPopUp(dlgPleaseWait);
  callLater( makePDF,['mypdf.pdf']);   // this function will cause makePDF to be called in the next 'frame' after UI update
}
0
 
DrachsAuthor Commented:
Sorry it took me so long to accept this solution, and thanks for taking the time to provide it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now