That worked thank u
--- In flexcoders@yahoogroups.com, "Ivan Wang" <ivan.wang2...@...> wrote:
>
> Not quite sure what's actually going on here. But you can try to remove
> listener in the corresponding result handler other than do it in another
> handler.
>
> ----- Original Message -----
> From: advancedonsite
> To: flexcoders@yahoogroups.com
> Sent: Sunday, August 23, 2009 10:02 AM
> Subject: [flexcoders] httpservice listener
>
>
> When using mxml httpservice
>
> <mx:HTTPService id="hsNutrition" url="/main.php/flexnutrition/nutritioncal"
> fault="nutritionFaultHandler(event)" resultFormat="e4x"/>
>
> I call the init on app load
>
> private function init():void
> {
> hsNutrition.addEventListener(ResultEvent.RESULT, nutritionResultHandler);
> hsNutrition.send();
>
> }
>
> private function nutritionResultHandler(event:ResultEvent):void
> {
> nutritionData = event.result as XML;
> Alert.show("NUTRITION RESULT");
> }
>
> I then later resuse the httpservice another area but this code does not
> seem to remove the nutritionResultHandler from the result, it actually calls
> both result events on one http send?
> Any ideas what might be happening?
>
> hsNutrition.removeEventListener(ResultEvent.RESULT, nutritionResultHandler);
> hsNutrition.request.byo = "b";
> hsNutrition.addEventListener(ResultEvent.RESULT, createYourOwnMeal_result);
>
> hsNutrition.send();
>
>
> }
>