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

Posted on 2008-11-10
Last Modified: 2013-11-11
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?

dlgPleaseWait = PopUpManager.createPopUp(this, PleaseWait, true) as PleaseWait;


Open in new window

Question by:Drachs
    LVL 19

    Accepted Solution

    function makePDF( fn:String):void
      makePDF();   // do the hard work here

    function onClick():void
      dlgPleaseWait = PopUpManager.createPopUp(this, PleaseWait, true) as PleaseWait;
      callLater( makePDF,['mypdf.pdf']);   // this function will cause makePDF to be called in the next 'frame' after UI update

    Author Closing Comment

    Sorry it took me so long to accept this solution, and thanks for taking the time to provide it.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now