navigateToURL() - How to get flex to stay in "loading" mode


I am trying to open a url via flex per standard code below, this url will take a long time to load as it creates a large excel file. The problem i am having is right after navigateToRUL() is called, flex hides the hourglass and returns the control of the screen back to the user BUT you can see it's still trying to load the url so the user gets a frozen screen.  

How do i lock the screen with the hourglass/loading until the url page is actually completed loading.  Thanks

var url:String = "ExcelExport";
var request:URLRequest = new URLRequest(url);

request.method = URLRequestMethod.POST; = formParams;


Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

As you are using flex, you can set the top most container of your application enabled=false and change the cursor using CursorManager.

Warm Regards
Deepanjan Das
I agree with deepanjandas,
You can manually set busy cursor indicator by using


call and remove after receiving result


What I don't see in your example, but better option to use mx:HTTPServices

<mx:HTTPService url="" result="onResult(event)" fault="onFault(event)"/>

and allow handle result and timeout by Adobe code.

gagaliyaAuthor Commented:

httpservice doesnt seem to work for excel export. I can see the request hitting the server and generating the excel and the cursor changing to busy then back, but nothing happens on the gui, i dont get the popup asking "save file, open file, etc.."  as I do with NavigateToUrl.   Thank you for your help.

<mx:HTTPService id="excelExportHTTP" url="" useProxy="false" method="POST" result="onExcelExportFinish()"   />

protected function onExcelButtonClick(event:ResultEvent):void
       var formParams:URLVariables = new URLVariables();
       formParams.someinput = "somevalue";			
       // navigateToURL(request,"_self");

private function onExcelExportFinish():void

here's the java servlet code that the request goes to:

public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException 
	        	 response.setContentType("application/; charset=UTF-8");
	        	 final PrintWriter out = response.getWriter();
	        	 out.println("<table cellpadding=10 cellspacing=10>");

Open in new window

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Sorry looks like now by default showBusyCursor=false can you change to true?

<mx:HTTPService showBusyCursor="true"/>
gagaliyaAuthor Commented:
dgofman, my problem is the excel doesnt come back to the gui.  When I use navigateToURL() i get a prompt asking if i want to save/open the excel file,  when I use HTTPService nothing gets returned to the gui. I cant get the excel file.
The problem if you will use navigateToURL you are out of Flex or Flash application.

Its like your are open a new browser or tab.

I understood you cannot open Excel in ActionScript but maybe when you are opening a new URL you have to modified your backend code to generate Excel inside HTML FRAMESET/FRAME where in one frame 100% width and height you will use Excel file and another frame what will be invisible you will create another very small SWF file (1KB) for opening communication with your main SWF using LocalConnection.

In this case you will able to pass command to hide busy cursor when HTML page loaded

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gagaliyaAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.