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?
dgofmanConnect With a Mentor Commented:
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
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.

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

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

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.
gagaliyaAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.