|
-
Problem using send() in HTTPService
Hi everyone,
I am getting problem in sending and receiving data from an asp.net file by using HTTPService. I already spent 2 days to fix this problem but cant find any clue.
Actually, my flex code communicates with the asp file and send an id, The asp file takes the id and returns some file names and file ids but using send() method.
When i call this method again, the flex data dont refresh it self and as a result i have to click the button again and it displays all the data. In this way i have to click twice on a button to get the required job.
Can anyone suggest me a way to do it on a single click. I also tried to use a timer function but no luck Please help me ASAP.
Here is the code i use to do it, please lemmek now if u find any error in it.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HTTPService url="http://www.battleoffs.com/badgevoterate.aspx" id="h1" showBusyCursor="true" method="POST" >
<mx:request xmlns="">
<won>{won.text}</won>
<loss>{loss.text}</loss>
<contid>{dbid.text}</contid>
</mx:request>
</mx:HTTPService>
<mx:Script>
<![CDATA[
public var wonv:String;
public var cont:int=0;
public var lossv:String;
public var dbidv:String='94';
public var showresv:String;
public var itemidv:String;
public var ratev:String;
private var t:Timer;
private function start():void{
dbid.text=dbidv;
won.text=h1.lastResult.content.fileid;
loss.text=h1.lastResult.content.fileid2;
//t.start();
h1.send();
}
]]>
</mx:Script>
<mx:TextInput id="won" x="0" y="10" text="204"/>
<mx:TextInput id="loss" x="0" y="40" text="124"/>
<mx:TextInput id="dbid" x="0" y="70"/>
<mx:TextInput id="text1" x="0" y="100"/>
<mx:Panel x="0" y="220" title="Read From DataBase" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" width="516" height="260">
<mx:DataGrid id="dgh1" x="301" y="10" dataProvider="{h1.lastResult.content}" width="474">
<mx:columns>
<mx:DataGridColumn headerText="File Name 1" dataField="filename" width="116"/>
<mx:DataGridColumn headerText="File id 1" dataField="fileid" width="25"/>
<mx:DataGridColumn headerText="File Name 2" dataField="filename2" width="116"/>
<mx:DataGridColumn headerText="File id 2" dataField="fileid2" width="25"/>
<mx:DataGridColumn headerText="rep" dataField="count" width="25"/>
</mx:columns>
</mx:DataGrid>
<mx:Button label="Read" click="h1.send();start();"/>
</mx:Panel>
</mx:Application>
Waqas A.M. Siddiqui (Vicky)
Graphics Designer
-
OOP is one letter from OOPS
Does not look like you defined any functions to handle the results of the HTTPService call.
-
The start function gets the value from HTTP Service
private function start():void{
dbid.text=dbidv;
won.text=h1.lastResult.content.fileid;
loss.text=h1.lastResult.content.fileid2;
//t.start();
h1.send();
}
while the button calls this function on click event
<mx:Button label="Read" click="h1.send();start();"/>
Waqas A.M. Siddiqui (Vicky)
Graphics Designer
-
OOP is one letter from OOPS
No I mean you need a function to handle the result of the HTTPService call. Call such as this are what is referred to as asynchronous. Take a look at this URL for more info.
http://www.adobe.com/devnet/flex/qui...t/httpservice/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|