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

Hi,

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;
request.data = formParams;

navigateToURL(request,"_self");

Open in new window

LVL 1
gagaliyaAsked:
Who is Participating?
 
dgofmanConnect With a Mentor Commented:
The problem if you will use navigateToURL you are out of Flex or Flash application.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/package.html

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.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/LocalConnection.html

In this case you will able to pass command to hide busy cursor when HTML page loaded
0
 
deepanjandasCommented:
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
0
 
dgofmanCommented:
I agree with deepanjandas,
You can manually set busy cursor indicator by using

CursorManager.setBusyCursor()

call and remove after receiving result

CursorManager.removeBusyCursor()

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

<mx:HTTPService url="http://yourdomain.com/ExcelExport" result="onResult(event)" fault="onFault(event)"/>

and allow handle result and timeout by Adobe code.



0
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:
Hi

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="domain.com/excel" useProxy="false" method="POST" result="onExcelExportFinish()"   />

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

private function onExcelExportFinish():void
{
	unlockScreen();
}

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

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

Open in new window

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

<mx:HTTPService showBusyCursor="true"/>
0
 
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.
0
 
gagaliyaAuthor Commented:
Thanks
0
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.