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 7769381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:08:44+00:00 2026-06-01T16:08:44+00:00

I’m using Flash Builder 4.6. As a simple example, say I have the following

  • 0

I’m using Flash Builder 4.6. As a simple example, say I have the following application:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:sdk="services.sdk.*">
    <fx:Script>
        <![CDATA[
            private function btnGetValue_clickHandler():void
            {
                getValueResult.token = sdk.getValue();
            }

            private function getValueResultHandler():void
            {
                // ...
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <sdk:SDK id="sdk" fault="{Alert.show(event.fault.faultString +'\n\n'+ event.fault.faultDetail, 'SDK ERROR');}" showBusyCursor="false"/>
        <s:CallResponder id="getValueResult" result="getValueResultHandler()"/>
    </fx:Declarations>
    <s:Button id="btnGetValue" click="btnGetValue_clickHandler()" label="Get Value" />
</s:Application>

So when you click on the button, it calls a PHP file and when it gets a result, it calls getValueResultHandler(). Easy enough.

But what if the response from the PHP file takes a second or two and the user clicks the button rapidly? Then the result handler function may not get called every time, since the call responder gets a new token before it received the last response.

Is there a standard way of resolving this issue? I came up with the following workaround, and it works fine, but it seems like this issue would be common enough to have a more built-in solution.

My workaround is:

var getValueResultProcessing:Boolean = false;

private function btnGetValue_clickHandler():void
{
    var interval:uint = setInterval(function():void
    {
        if (!getValueResultProcessing)
        {
            getValueResultProcessing = true;
            getValueResult.token = sdk.getValue();
            clearInterval(interval);
        }
    }, 100);
    getValueResult.token = sdk.getValue();
}

private function getValueResultHandler():void
{
    getValueResultProcessing = false;
    // ...
}

Any better way of resolving this issue?


EDIT:

One of my actual scenarios for which I need a solution is when looping:

private function btnGetValue_clickHandler():void
{
    var arr:Array = new Array("value1", "value2", "value3");
    for each (var value:String in arr)
        getValueResult.token = sdk.getValue(value);
}

So to solve this problem I make arr a global variable and use the setInterval method I described before to shift off the first element and then do the same exact thing in the result function until arr is empty.

Again, looking for a more “standard” solution, if such a thing exists.

  • 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-06-01T16:08:46+00:00Added an answer on June 1, 2026 at 4:08 pm

    Instead of using CallResponder, you might want to manage the responses to service calls yourself. HTTPService (or similar Flex services) return an AsyncToken when you call the HTTPService.send() method. You can then add ‘result’ and ‘fault’ handlers by using the AsyncToken.addResponder() method.

    If you do it this way, each responder will trigger it’s result or fault handler as appropriate. Then use the last approach as suggest by Sam DeHaan, where you store each token in an array when the call is made, and remove the token from the array when the ‘result’ or ‘fault’ handler is executed. When removing a token from the array, you can re-enable the button if the array is empty.

    You do it something like this (typing code from memory):

    var service:HTTPService = new HTTPService();
    // configure the service...
    var token:AsyncToken = service.send();
    // resultHandlerMethod and faultHandler method are functions that you should define
    // their signatures look like this:
    // resultHandlerMethod(event:ResultEvent)
    // faultHandlerMethod(event:FaultEvent)
    token.addResponder(new Responder(resultHandlerMethod, faultHandlerMethod);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't

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.