flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Chiverton ...@extravision.com>
Subject Re: Async call inside a class
Date Tue, 11 Jun 2013 09:01:50 GMT
The formatting in that is screwed up. Please post it somewhere where it 
stays indented.

You probably want to remove all the extra stuff that has no relation to 
the issue like all the private variables and so on.

Tom

On 11/06/2013 09:31, Sumudu Chinthaka wrote:
> hi
>
> i have a class with a webservice call in the constructor and i want to
> handle the result upon successful execution of web service
> but Event.COMPLETE inner function never get executed
>
> what should i do to make it possible
>
> if i  place this code in UI component then it;ll get executed but once i
> separate it to another class it doesn't work
>
>
>
>
> [Bindable]
> public class TestDataProvider
> {
>   private var isReturn:Boolean = false;
> private var originAirport:Airport = new
> Airport().AirportInitializer("IKA","IKA","IKA");
> private var destinationAirport:Airport = new
> Airport().AirportInitializer("DUS","DUS","DUS");
> private var departureDate:Date = new Date(2013,5,29);
> private var arrivalDate:Date = new Date(2013,5,29);
> private var adult:Number = 1;
> private var children:Number = 0;
> private var infant:Number = 0 ;
>   private var flightResult:ArrayCollection;
> private var searchCriteria:AvailabilitySearchDTO
> private var transactionID:String;
>   private var priceQuotResultDTO:PriceQuotResultDTO;
>   public function TestDataProvider()
> {
> searchCriteria = new
> AvailabilitySearchDTO().AvailabilitySearchDTOInitializer(this.isReturn,this.originAirport,this.destinationAirport,this.departureDate,this.arrivalDate,this.adult,this.children,this.infant);
> var avalabilitySearchReq:AvalabilitySearchRequest = new
> AvalabilitySearchRequest(searchCriteria);
>   var request:URLRequest = new URLRequest();
> var urlLoader:URLLoader = new URLLoader();
>   request.contentType = "text/xml; charset=utf-8";
> request.method = "POST";
> request.url = Globals.ISA_WEB_SERVICE_URL;
>   var SOAPAction:URLRequestHeader = new
> URLRequestHeader("SOAPAction","getAvailability");
> request.requestHeaders.push(SOAPAction);
> request.data = avalabilitySearchReq.xmlData;
> urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
> urlLoader.load(request);
> urlLoader.addEventListener(Event.COMPLETE, function (event:Event):void{
>   var asObj:Object = XmlUtility.getObjectFromXMLTypeString(event.target.data)
>   if(asObj.Envelope.Body.OTA_AirAvailRS.Errors == null)
> {
>   var tmpObj:Object =
> asObj.Envelope.Body.OTA_AirAvailRS.AAAirAvailRSExt.PricedItineraries.PricedItinerary.AirItinerary.OriginDestinationOptions.OriginDestinationOption;
> var priceInfo:Object =
> asObj.Envelope.Body.OTA_AirAvailRS.AAAirAvailRSExt.PricedItineraries.PricedItinerary.AirItineraryPricingInfo;
> transactionID = asObj.Envelope.Body.OTA_AirAvailRS.TransactionIdentifier;
>   if(tmpObj is ArrayCollection){
> flightResult = tmpObj as ArrayCollection;
> }else{
> flightResult.addItem(tmpObj);
> }
>   var searchResDTO:AvailabilitySearchResultDTO = new
> AvailabilitySearchResultDTO().AvailabilitySearchResultDTOInitializer(flightResult,searchCriteria,transactionID);
>    var request:URLRequest = new URLRequest();
> var urlLoader:URLLoader = new URLLoader();
> var availabilitySearchResultDTO:AvailabilitySearchResultDTO = searchResDTO;
> priceQuotResultDTO = new
> PriceQuotResultDTO().PriceQuotResultDTOInitializer(availabilitySearchResultDTO);
>   }
>   });
>   }
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________


Mime
View raw message