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?

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

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

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

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