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

  • Home
  • SEARCH
  • 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 309809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:46:33+00:00 2026-05-12T07:46:33+00:00

I am trying to understand the way the AsyncToken works in actionscript. How can

  • 0

I am trying to understand the way the AsyncToken works in actionscript. How can I call a remote service and ensure that a specific parameter is available in the result or fault event functions? I think it is the async functionality I want to use.

The following code will hopefully explain what I am trying to do. Feel free to modify the code block as your explanation.

Thanks.

public function testSerivceCall(data:Object, callBackCommand:String):void
{
    // Assume callBackCommand == "FOO";
    // How can I pass in callBackCommand as a parameter to the result or fault events?
    // How do I create an async token here?

    var remoteObject:RemoteObject;
    remoteObject = new RemoteObject();
    remoteObject.destination = "zend";
    remoteObject.source = "MyService";
    remoteObject.endpoint = "http://example.com/service";
    remoteObject.test.addEventListener(ResultEvent.RESULT, _handleTestResult);
    remoteObject.test.addEventListener(FaultEvent.FAULT, _handleTestFault);
    remoteObject.test(data);
}

private function _handleTestResult( event:ResultEvent ) : void 
{ 
    // How do I get the async token value?
    // How can I get the value of callBackCommand in this code block?

    if (callBackCommand == "FOO")
    { 
        // do something related to "FOO"
    }
    else
    {
        // do something else with the result event
    }


} 

private function _handleTestFault( event:FaultEvent ) : void 
{ 
    // How do I get the async token value?
    // How can I get the value of callBackCommand in this code block?
} 

An edit to make this question more clear:

Assume I make the following method call somewhere in my code:

testSerivceCall(personObject, "LoginCommand");

How do I get access to the actual string “LoginCommand” inside the _handleTestResult function block?

The reason I want to do this is because I want to dynamically call back certain functions and hand off the result data to specific commands that I know ahead of time when I am making the service call.

I am just having a time grokking the AsyncToken syntax and functionality.

  • 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-12T07:46:33+00:00Added an answer on May 12, 2026 at 7:46 am

    If you want to access the properties used during the remote call (parameters to the call and/or AsycToken), you can make use of closures. Just define the result event handler inside the calling method as a closure. It can then access any variable in the calling function.

    public function testSerivceCall(data:Object, callBackCommand:String):void
    {
        var _handleTestResult:Function = function( event:ResultEvent ) : void 
        { 
            // token is visible here now
            if (callBackCommand == "FOO")
            { 
                // do something related to "FOO"
            }
            else
            {
                // do something else with the result event
            }
        }
    
        var remoteObject:RemoteObject;
        remoteObject = new RemoteObject();
        remoteObject.destination = "zend";
        remoteObject.source = "MyService";
        remoteObject.endpoint = "http://example.com/service";
        remoteObject.test.addEventListener(ResultEvent.RESULT, _handleTestResult);
        remoteObject.test.addEventListener(FaultEvent.FAULT, _handleTestFault);
        var token = remoteObject.test(data);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to understand the way ActionScript's events are implemented, but I'm
I'm trying to understand the way ARC works, and as far as I know,
I'm trying to understand the proper way to free the memory that is pointed
I am trying to understand is there a way I can record calls incoming
Hey guys, I'm starting with Zend, and trying to understand the way it works
I'm trying to understand why something works the way it does in jQuery. When
I'm trying to understand the best way to implement Python's ConfigParser so that elements
I'm trying to understand what's the best way to manage older unit test that
Just trying to understand what can be measured. Is there a way to measure
Trying to understand what's the correct way of implementing OpenID authentication with Spring Security.

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.