This content has been marked as final. Show 3 replies
You want to use the ACT pattern. I'll post a link below, but essentially what happens is that the send() method returns a "call" object. You can add any property you want to this object, string, id, number, even functions. When the result comes back, this call object is available to you in the result handler function, and you can get back whatever you put in.
I usually just put in a string that identifies the query, and use a select statement to decide how to process it.
Check out this example below.
oh, it's very wonderful.I appreciate your help very much.
Actually, i found i had wrote ugly codes before.
If i need to request httpservice twice, i orignally use two <mx:Httpservice> tag.As i do not know how to distinguish between each other.
If i need two name list, A and B
<mx:HTTPService id="hsA" result="GetA()" />
<mx:HTTPService id="hsB" result="GetB()" />
In function GetA(), i do hsB.send().
Now I wonder if i use only one HTTPService Object to solve the problem.
I test much, but only find a even more ugly way.Here's my codes.
In a Init function, i add an event listener to the hsA as i want to use "removeEventListener" later.
funDelegate = mx.utily.Delegate.create(this, GetA)
and in function GetA
funDelegate = mx.utily.Delegate.create("result", funDelegate);
Is it a suitable way?
thanks in advance.
oh, i read the article you offerred and only to find i really wrote silly codes.I know how to cop with it.Thanks a lot