Jay Roy
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:ArrayCollectio n;
public function init():void {
projectSummary.fetchUserPr oject(user .name); -- Makes remote call
}
private function projectListHandler(event:R esultEvent ):void
{
projectList = event.result as ArrayCollection --fetch results
}
]]>
</mx:Script>
<mx:RemoteObject id="projectSummary" destination="projectBusine ssService" >
<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
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:ArrayCollectio
public function init():void {
projectSummary.fetchUserPr
}
private function projectListHandler(event:R
{
projectList = event.result as ArrayCollection --fetch results
}
]]>
</mx:Script>
<mx:RemoteObject id="projectSummary" destination="projectBusine
<mx:method name="fetchUserProject" result="projectListHandler
</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
<mx:columns>
//display data
</mx:columns>
</mx:DataGrid>
</mx:VBox>
any ideas appreciated...thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.len gth} />
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
and embed into ActionScript
Embed(source="bar.swf");
but you should reverse a component visibility
<mx:Image source="{loaderIcon}" visible="{!projectList.len
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
ASKER
thanks.
ASKER
"Loading..." . any idea how i can do that?
thanks