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()">
[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:RemoteObject id="projectSummary" destination="projectBusinessService">  
<mx:method name="fetchUserProject" result="projectListHandler(event)"/>
 <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">
 //display data       

any ideas appreciated...thanks
Who is Participating?
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;
royjaydAuthor Commented:
ok...thanks. Also i want to display a animation image like
"Loading..." . any idea how i can do that?

Create annimation image using CS4\5 products
and embed into ActionScript


but you should reverse a component visibility

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


royjaydAuthor 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.