display message after remote call returns

hi guys

This is one of my mxmls. The problem is i have lable <mx:Label text="You have these projects"..>  when the mxml loads a remote call is made to the server using init(). Only AFTER results are fetched from the server i want to show the label 'You have these projects'.  Right now i see the label right after the mxml loads. Any idea how i can avoid that displaying of label and show it only after remote call returns results?  Also i want to show a animation image like 'Loading..'  while it is loading the results.


Here is the mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
<mx:Script>
<![CDATA[
[Bindable]private var user:Object;            
[Bindable] public var projectList:ArrayCollection;
public function init():void {
projectSummary.fetchUserProject(user.name); -- Makes remote call
            }

private function projectListHandler(event:ResultEvent):void
{
projectList = event.result as ArrayCollection   --fetch results
}      
]]>
</mx:Script>
      
<mx:RemoteObject id="projectSummary" destination="projectBusinessService">  
<mx:method name="fetchUserProject" result="projectListHandler(event)"/>
</mx:RemoteObject>
      
 <mx:Label text="You have these projects" width="379"  fontWeight="bold" fontSize="12" />
-- This label displays before the results are fetched.I want to display this label after results are fetched. I want to show a 'Loading..' animation image      
<mx:DataGrid id="dataGrid" dataProvider="{projectList}" width="862" rowCount="5" editable="true">
<mx:columns>
 //display data       
</mx:columns>
</mx:DataGrid>
</mx:VBox>

any ideas appreciated...thanks
royjaydAsked:
Who is Participating?
 
dgofmanCommented:
You can manually hide this label or bind to your result list

<mx:Label text="You have these projects" width="379"  fontWeight="bold" fontSize="12"
visible="{projectList.length > 0} />

When you will send request again don't forget to set this variable to null (for hide label again)

projectList = null;
0
 
royjaydAuthor Commented:
ok...thanks. Also i want to display a animation image like
"Loading..." . any idea how i can do that?

thanks
0
 
dgofmanCommented:
Create annimation image using CS4\5 products
and embed into ActionScript

Embed(source="bar.swf");

but you should reverse a component visibility

<mx:Image source="{loaderIcon}" visible="{!projectList.length} />

http://livedocs.adobe.com/flex/3/html/help.html?content=embed_3.html

http://cookbooks.adobe.com/post_How_to_embed_swf_file_containing_ActionScript_code-12871.html
0
 
royjaydAuthor 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.