Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Developer
Posts: 6
Registered: ‎05-31-2011
My Device: Torch 9800
Accepted Solution

Creating a modal wait screen in ActionScript

Hi Everyone,

 

Firstly, this forum has provided me with some great advice on getting my first PlayBook release onto App World so a big thanks to everybody at RIM and the community in general for the help.

 

My Problem

 

I developed my application for AIR 2.5 using Flash Builder 4.5 and the BlackBerry PlayBook AIR APIs.

 

My application performs a long-running operation which, via a click event, calls a web service and requests some data.  Currently, the application doesn't provide the user with any feedback and I'd like to change that!

 

I'm relatively new to the Flash Builder and wondered what was the best way to execute an operation like this and display a transparent "wait modal" perhaps with an activity indicator to the user while it's happening.

 

I have tried to implement this in several ways (using shapes. containers etc.) however the modal never displays when the onClick event is fired.  I also looked into background processing but was warned against using this.

 

Any advice would be greatly appreciated.  I'm relatively new to this development environment, so apologies if this is obvious!

 

Thanks in advance.

 

Nick

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Creating a modal wait screen in ActionScript

A request to a server is non-blocking, so you could allow the user to continue to work until the server job is complete which you will get the callback.  In this case you could use the ActivityIndicator to let the user know that it is being processed (passive indication).  If the job does take a long time and there is a way to poll the status of the job then a passive ProgressBar would show overall progress.  Both of these can be placed in a corner of the screen so the user can see it, but can continue to work as needed.

 

However, if the job is a blocking request in which you dont want the user to do anything until the job is done, then you will want to be a modal about it (less desireable).  You could place an AlertDialog window up with "Please wait..." in it with no buttons and then dismiss the dialog when the job is complete.  You will need to keep a handle to the alert dialog so you can close it with the callback event.  Since QNX AlertDialogs are server side and you cannot modify the look, you could build your own screen with a semi-transparent background and the ActivityIndicator or ProgressBar inside a frame to show progress/activity with modality.  Connect the custom modal view to the stage.  If you have an application bar, you may need to suspend that so the user cannot traverse to another page of your application.

 

If the job is truely long, I would add a "cancel" features in case it is just taking too long for them due to network issues.

 

Hope that helps.

Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course

Re: Creating a modal wait screen in ActionScript

Have a look at the SkinnablePopupContainer class. You can put whatever you like in it (e.g. a status label, a progress indicator, a cancel button etc). Then call the .open() method. One of the parameters allows you to make it modal.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands