Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 554653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:43:58+00:00 2026-05-13T11:43:58+00:00

Where can I find an example of Flex application which implements an HTTPService asynchronously

  • 0

Where can I find an example of Flex application which implements an HTTPService asynchronously called by an AsyncToken and an AsyncResponder?
Thanks in advance

the httpservice send a string like this with a certain frequency:

row#column#number#row#column#number#row#column#number#….

EDITED CODE:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application creationComplete="onCreationComplete()" 
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
    import mx.rpc.remoting.RemoteObject;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.http.mxml.HTTPService;
    import mx.rpc.AsyncRequest;
    import mx.rpc.AsyncResponder;
    import mx.rpc.AsyncToken;
    import mx.collections.ArrayCollection;
    import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
    import mx.controls.AdvancedDataGrid;
    import mx.controls.Alert;
    import mx.rpc.IResponder;


    [Bindable]
    public var dataList:ArrayCollection;

    public function getResults(source:String) : ArrayCollection {
    var ac:ArrayCollection = new ArrayCollection();
    var data:Array = source.split('#');
    for (var i:int = 0; i < data.length; i += 3) {
    var dataObj:Object = {row: data[i], column: data[i+1], value: data[i+2]};     
    ac.addItem(dataObj)
    }

    return ac;
    }
    public function result(event:ResultEvent):void{
    dataList = getResults( String(event.result) );
    }
    public function fault(event:FaultEvent) : void {
    dataList = getResults(String(event.fault)); 
    }

public function onCreationComplete():void
{
var service:HTTPService = new HTTPService();
service.url = "http://10.15.20.75/server4flex/servlet/Datagen";
service.resultFormat = "text";
var token:AsyncToken = service.send(dataList);
token.addResponder(new mx.rpc.Responder(result, fault));
}

]]>
</mx:Script>
<mx:AdvancedDataGrid id="dg"
dataProvider="{result}"  
liveScrolling="true"  
    x="10" y="10" width="621"
    verticalScrollPolicy="on"
 >
        <mx:columns>
                    <mx:AdvancedDataGridColumn dataField="row"
           headerText="Riga"/>
                    <mx:AdvancedDataGridColumn dataField="column"
           headerText="Colonna"/>
                    <mx:AdvancedDataGridColumn dataField="value" 
           headerText="Valore"/>
        </mx:columns>
 </mx:AdvancedDataGrid>

 </mx:Application>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:43:58+00:00Added an answer on May 13, 2026 at 11:43 am

    I dont know what you are really looking after but here or here for example, are way to use AsyncToken and AsyncResponder

    Edit:

    1. your dataList have to be Bindable
    2. Don’t set dataList on each loop iteration
    3. You have to call you function getResults at some point when your results are ready
    4. event in result function is an Event but also a ResultEvent where there is a result field containing your data

    Which may look as this (untested):

    [Bindable]
    public var dataList:ArrayCollection;
    
    public function getResults(source:String) : ArrayCollection {
        var ac:ArrayCollection = new ArrayCollection();
        var data:Array = source.split('#');
        for (var i:int = 0; i < data.length; i += 3) {  
         ac.addItem( {row: data[i], column: data[i+1], value: data[i+2]} );
        }
        return ac;
    }
    
    private function result(event:ResultEvent) : void {
     dataList = getResults( String(event.result) );
    }
    

    Edit2:

    this is a working example using a simple php file to get the data running on a local web server.

    Flex part

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application creationComplete="onCreationComplete()"
                xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
    <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.AsyncToken;
      import mx.rpc.Responder;
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.http.mxml.HTTPService;
    
        [Bindable]
        public var dataList : ArrayCollection;
    
        public function getResults(source : String) : ArrayCollection {
            var ac : ArrayCollection = new ArrayCollection();
            var data : Array = source.split('#');
            for (var i : int = 0; i < data.length; i += 3) {
                var dataObj : Object = {row: data[i], column: data[i + 1], value: data[i + 2]};
                ac.addItem(dataObj)
            }
    
            return ac;
        }
    
        public function result(event : ResultEvent) : void {
            dataList = getResults(String(event.result));
        }
    
        public function fault(event : FaultEvent) : void {
            //here do whatever you want to manage the error you received
        }
    
        public function onCreationComplete() : void
        {
            var service : HTTPService = new HTTPService();
            service.url = "http://127.0.0.1/getDatas.php";
            service.resultFormat = "text";
            var token : AsyncToken = service.send();
            token.addResponder(new mx.rpc.Responder(result, fault));
        }
    
    ]]>
    </mx:Script>
    <mx:AdvancedDataGrid id="dg"
                         dataProvider="{dataList}"
                         liveScrolling="true"
                         x="10" y="10" width="621"
                         verticalScrollPolicy="on"
            >
        <mx:columns>
            <mx:AdvancedDataGridColumn dataField="row"
                                       headerText="Riga"/>
            <mx:AdvancedDataGridColumn dataField="column"
                                       headerText="Colonna"/>
            <mx:AdvancedDataGridColumn dataField="value"
                                       headerText="Valore"/>
        </mx:columns>
    </mx:AdvancedDataGrid>
    
    </mx:Application>
    

    Php part (getDatas.php)

    <?php print "1#c1#v1#2#c2#v2#3#c3#v3"?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 297k
  • Answers 297k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer urllib2 has a functions called build_opener() and install_opener() which you… May 13, 2026 at 7:20 pm
  • Editorial Team
    Editorial Team added an answer Ok, I'm not really sure what the purpose of this… May 13, 2026 at 7:20 pm
  • Editorial Team
    Editorial Team added an answer The closest thing I have found is this: http://sculpture.codeplex.com/ I… May 13, 2026 at 7:20 pm

Related Questions

I am converting a remoting interface to WCF, however I have a method that
Where can I find an example implementation of the New Import Hooks described in
Does anyone know where I can find an example of how to determine if
Does anyone know where I can find an example of some javascript code for
I'm working in Delphi 2007. Net, where I can find an example of using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.