dimiorla
February 21st, 2009, 04:28 PM
Hey everyone,
Can i use multiple HTTPService in one flex application?
I have tried the following but it can have only one creationComplete= " "
Is their any work around?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="1024" height="800" backgroundColor="white" creationComplete= "menu.send()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var menuarray:ArrayCollection;
private function menuhandler (event:ResultEvent):void
{
menuarray=event.result.response.data.row;
}
[Bindable]
private var ordersarray:ArrayCollection;
private function ordershandler (event:ResultEvent):void
{
ordersarray=event.result.response.data.row;
}
]]>
</mx:Script>
<mx:HTTPService id="menu" url="http://localhost/kassa/menu.php?method=FindAll" result="menuhandler(event)" />
<mx:HTTPService id="orders" url="http://localhost/kassa/orders.php?method=FindAll" result="ordershandler(event)" />
<mx:DataGrid y="68.95" editable="false" enabled="true" width="490" height="682.05" fontFamily="Times New Roman" fontSize="25" id="menudataGrid" dataProvider="{menuarray}" left="10">
<mx:columns>
mx:DataGridColumn headerText="id" dataField="id" width="50"/>
<mx:DataGridColumn headerText="name" dataField="name" />
<mx:DataGridColumn headerText="price" dataField="price" width="100"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid y="68.95" width="490" height="392.05" id="ordersdataGrid" dataProvider="{ordersarray}" fontFamily="Times New Roman" fontSize="25" editable="false" enabled="true" right="10">
<mx:columns>
<mx:DataGridColumn headerText="id" dataField="id" width="50"/>
<mx:DataGridColumn headerText="name" dataField="name" />
<mx:DataGridColumn headerText="price" dataField="price" width="100"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Can i use multiple HTTPService in one flex application?
I have tried the following but it can have only one creationComplete= " "
Is their any work around?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="1024" height="800" backgroundColor="white" creationComplete= "menu.send()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var menuarray:ArrayCollection;
private function menuhandler (event:ResultEvent):void
{
menuarray=event.result.response.data.row;
}
[Bindable]
private var ordersarray:ArrayCollection;
private function ordershandler (event:ResultEvent):void
{
ordersarray=event.result.response.data.row;
}
]]>
</mx:Script>
<mx:HTTPService id="menu" url="http://localhost/kassa/menu.php?method=FindAll" result="menuhandler(event)" />
<mx:HTTPService id="orders" url="http://localhost/kassa/orders.php?method=FindAll" result="ordershandler(event)" />
<mx:DataGrid y="68.95" editable="false" enabled="true" width="490" height="682.05" fontFamily="Times New Roman" fontSize="25" id="menudataGrid" dataProvider="{menuarray}" left="10">
<mx:columns>
mx:DataGridColumn headerText="id" dataField="id" width="50"/>
<mx:DataGridColumn headerText="name" dataField="name" />
<mx:DataGridColumn headerText="price" dataField="price" width="100"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid y="68.95" width="490" height="392.05" id="ordersdataGrid" dataProvider="{ordersarray}" fontFamily="Times New Roman" fontSize="25" editable="false" enabled="true" right="10">
<mx:columns>
<mx:DataGridColumn headerText="id" dataField="id" width="50"/>
<mx:DataGridColumn headerText="name" dataField="name" />
<mx:DataGridColumn headerText="price" dataField="price" width="100"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>