Data loading, PleaseWait
Have a RemoteObject (WebService, HTTPRequest) call that takes a while to come back? Can't really do anything until it does come back? Give the user something to do! If you have a long running process and nothing for the user to see/do, they'll get distracted and move from your app to do something else.
PleaseWait.mxml
<mx:Panel
xmlns:mx="http://www.adobe.com/2006/mxml"
title="Please Wait ..."
horizontalAlign="center"
width="285" height="90">
<mx:Label
text="Please wait while employee data is loaded"/>
<mx:ProgressBar
indeterminate="true"
labelPlacement="center"/>
</mx:Panel>
This is basic, just a moving progress bar. But you could put a Sudoku game in there. Or trivia, or a porn slideshow, whatever!
public var pw:PleaseWait = new PleaseWait();
private function init():void{
ro.getEmployeeListXML();
pw.x = (this.width-pw.width)/2;
pw.y = (this.height-pw.height)/2;
mx.managers.PopUpManager.addPopUp(pw, this, true);
}
The RemoteObject (ro) does its thing. We wait. We read 5 fascinating facts about cheese. Then the ro returns and the popup goes away.
mx.managers.PopUpManager.removePopUp(pw);
empByLead = event.result as XML;
}
Now because it's adding and removing the pw object as a modal popup and not reinitializing it anywhere, you should be able to put continuing content (crossword puzzle, short story, documentary) things in it. I haven't tested it, but in theory it would save the state of things next time the popup comes up, on another long running process in the application.
Phase 2: Would be cool to have the return call tell the popup it's done. Then you could switch states in the popup, adding/enabling a "close" button. So if someone's just about to solve the puzzle it won't suddenly disappear.


There are no comments for this entry.
[Add Comment]