Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

ok...thanks. Also i want to display a animation image like
"Loading..." . any idea how i can do that?

thanks
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
Avatar of Jay Roy

ASKER

thanks.