How can I listen to the AsyncToken var events outside the implementation class

Hello

I use this:

public void doSomething (): void

{

var token:AsyncToken=myRemoteObject.getData();

token.addResponder (new mx.rpc.Responder (resultHandler, faultHandler));

}

private void resultHandler(event:ResultEvent):void

{

dispatchEvent (event);

}

private void faultHandler(event:FaultEvent):void

{

dispatchEvent (event);

}

And listening for events on the instantiated var.

Which is the right way to do it, or is there a better?

Thank you.

I often see classes of service built as follows:

public interface IMyService
{
          function loadData(id:int):AsyncToken;
          function publishData(data:Object):AsyncToken;
}

public class MyService implements IMyService
{
          private var _remoteObject:RemoteObject;

          protected function get remoteObject():RemoteObject
          {
                    if(!_remoteObject)
                    {
                              _remoteObject = new RemoteObject("MyDestination");
                              _remoteObject.showBusyCursor = true;
                              _remoteObject.source = "my_service";
                    }

                    return _remoteObject;
          }

          public function loadData(id:int):AsyncToken
          {
                    return this.remoteObject.loadData(id);
          }

          public function publishData(data:Onject):AsyncToken
          {
                    return this.remoteObject.publishData(data);
          }

}

public class MyController
{

          public var service:IMyService = new MyService(); //or find a better way to inject

          public function doStuff(id:int):void
          {
                    var token:AsyncToken = this.service.loadData(id);
                    token.addResponder(new Responder(loadData_resultHandler, loadData_faultHandler));
          }

     ...
}

The actual implementation may vary, but the idea is to have a class with methods that reflects your methods of service class and then summarized this thanks to an interface to allow different service implementations (if you want of course). It is of class type is usually referred to as a proxy or delegate class.

I think mostly it's a matter of personal preference, but I've seen it implemented in this way by a large number of executives main (the Flash Builder function generator is one of them).

Fixed type in the code.

Tags: Flex

Similar Questions

  • How can I listen to the music of Nirvana or Lil' Wayne?

    It indicates the MyFamily security settings do not allow me to listen to demo os the song when I click it. But my father said that he doesn't know how to change. It justs brings to something else that isn't about music when he clicks on "to remove a member of the family of my family, go to security settings on Microsoft family ."

    any help? Thank you

    Hi RodolfoPortillo1,

    I think that your father needs to change your account under parental controls, specifically the section entitled Restrictions on game. This section lets you Store Windows game and game restrictions, which I think handles music, since music is a subset of the Microsoft Store. I couldn't find another thing that seems to restrict the music in the safety of the family.
    I hope this helps!
    David

  • I can't use my Casio synthesizer as input/output audio device on Windows 7. How can I listen to the MIDI on the synth tracks?

    It seems to be connected and working as I look in Device Manager. Yet I have such not selectable in the config of sound device. It is not found to read settings or the settings of the records. Back then on Windows XP without problems.

    P. S.: sorry for my bad English.

    Hello

    Here's a similar question post that you may find useful.

    The release of Windows 7 MIDI device selection

  • How can I listen to the event changed to a tableview column width

    I really want to do some painting when the column is resized manually.
    but it seems that it is not a test of reszie javafx column, is it?
    TableColumn dateCol = new TableColumn("Date");
     dateCol.setCellValueFactory(new PropertyValueFactory("longrowid")); 
    
    dateCol.widthProperty().addListener(new ChangeListener(){
            @Override public void changed(ObservableValue o,Object oldVal,
                     Object newVal){
                 System.out.println("Width property has changed!");
            }
          });
    
  • ESX 2.5 - How can I confirm if the server is start from the MUI SAN or SSH?

    ESX 2.5 - How can I confirm if the server is start from the MUI SAN or SSH?

    [root@esx011 /] # wwpn.pl
    vmhba0: 210000e08b1a51d3 (Qlogic) 5:4:0
    vmhba1: 210000e08b1a03d1 (Qlogic) 7:3:0

    [root@esx011 /] # wwpn.pl - v
    WWPN 1.02 Copyright VMware 2003
    Display the names of WW and VMHBA ports for fiber channel cards
    For each relevant here are the Qlogic vmhba and names of Port Emulex WW
    Adapter WWPN PCI (decimal)
    vmhba0: 210000e08b1a51d3 (Qlogic) 5:4:0 / proc/scsi/qla2300/2
    vmhba0:0: scsi-qla0-port-0 5005076300c7b4a2 = 5005076300c0b4a2:5005076300c7b4a2;
    vmhba0:10: scsi-qla0-port-10 500507680110b79d = 500507680100b79d:500507680110b79d;
    vmhba0:11: scsi-qla0-port 5005076300cc9561 - 11 = 5005076300 c 09561: 5005076300cc9561;
    vmhba0:12: scsi-qla0-port-12 5005076300c80db4 = 5005076300c00db4:5005076300c80db4;
    vmhba0:13: scsi-qla0-port-13 5005076300cbb0b1 = 5005076300c0b0b1:5005076300cbb0b1;
    vmhba0:1: 500507630308414 d scsi-qla0-port-1 = 5005076303ffc14d:500507630308414 d;
    vmhba0:2: 500507630313414 d scsi-qla0-port-2 = 5005076303ffc14d:500507630313414 d;
    vmhba0:3: scsi-qla0-port-3 5005076300c7b0b1 = 5005076300c0b0b1:5005076300c7b0b1;
    vmhba0:4: scsi-qla0-port-4 5005076300cbb4a2 = 5005076300c0b4a2:5005076300cbb4a2;
    vmhba0:5: scsi-qla0-port-5 5005076300cca01d = 5005076300c0a01d:5005076300cca01d;
    vmhba0:6: scsi-qla0-port-6 5005076300cc0db4 = 5005076300c00db4:5005076300cc0db4;
    vmhba0:7: b 500507680140, 799 scsi-qla0-port-7 = b 500507680100 799:500507680140 b 799;
    vmhba0:8: scsi-qla0-port-8 5005076300cfa01d = 5005076300c0a01d:5005076300cfa01d;
    vmhba0:9: 5005076300 c 89561 scsi-qla0-port - 9 = 5005076300 c 09561:5005076300 c 89561;
    vmhba1: 210000e08b1a03d1 (Qlogic) 7:3:0 / proc/scsi/qla2300/3
    vmhba1:0: scsi-qla1-port-0 5005076300d0a01d = 5005076300c0a01d:5005076300d0a01d;
    vmhba1:10: scsi-qla1-port-10 5005076300cf0db4 = 5005076300c00db4:5005076300cf0db4;
    vmhba1:11: 500507630318414 d scsi-qla1-port-11 = 5005076303ffc14d:500507630318414 d;
    vmhba1:12: 5005076300 c 49561 scsi-qla1-port - 12 = 5005076300 c 09561:5005076300 c 49561;
    vmhba1:13: 5005076300 d 09561 scsi-qla1-port - 13 = 5005076300 c 09561:5005076300 d 09561;
    vmhba1:1: scsi-qla1-port-1 5005076300c4b4a2 = 5005076300c0b4a2:5005076300c4b4a2;
    vmhba1:2: b 500507680130, 799 scsi-qla1-port-2 = b 500507680100 799:500507680130 b 799;
    vmhba1:3: scsi-qla1-port-3 5005076300c4b0b1 = 5005076300c0b0b1:5005076300c4b0b1;
    vmhba1:4: scsi-qla1-port-4 5005076300d0b0b1 = 5005076300c0b0b1:5005076300d0b0b1;
    vmhba1:5: scsi-qla1-port-5 5005076300c4a01d = 5005076300c0a01d:5005076300c4a01d;
    vmhba1:6: 500507630303414 d scsi-qla1-port-6 = 5005076303ffc14d:500507630303414 d;
    vmhba1:7: scsi-qla1-port-7 500507680120b79d = 500507680100b79d:500507680120b79d;
    vmhba1:8: scsi-qla1-port-8 5005076300d0b4a2 = 5005076300c0b4a2:5005076300d0b4a2;
    vmhba1:9: scsi-qla1-port-9 5005076300c30db4 = 5005076300c00db4:5005076300c30db4;
    [root@esx011 /] # vdf h
    Size of filesystem used Avail use % mounted on
    / dev/sda1 3.0 G 2.5 G 364 M 88%.
    / dev/sda3 15G 5.6 G 8.3 G 40% / images
    No 392M 392M 0 0% / dev/shm
    / dev/sda6 23% 424 M 1.4 G 2.0 G/var
    / dev/sda5 7.7 G 81 M 7.2 G 2% /vmadmin
    vmhba0:0:0:1 91 82 G 8.5 G 90% / vmfs / vmhba0:0:0:1
    vmhba0:1:10:1 15 G 15 G 0% 7.0 M / vmfs / vmhba0:1:10:1
    63 7.7 M 63 0% G G vmhba0:1:11:1 / vmfs / vmhba0:1:11:1
    vmhba0:1:1:1 63 63 G 0 100% / vmfs / vmhba0:1:1:1
    vmhba0:1:2:1 15 G 14 G 1.1 G 93% / vmfs / vmhba0:1:2:1
    vmhba0:1:3:1 63 63 G 0 100% / vmfs / vmhba0:1:3:1
    vmhba0:1:4:1 63 63 G 0 100% / vmfs / vmhba0:1:4:1
    vmhba0:1:5:1 15 G 14 G 1.1 G 93% / vmfs / vmhba0:1:5:1
    vmhba0:1:6:1 63 63 G 0 100% / vmfs / vmhba0:1:6:1
    vmhba0:1:7:1 63 63 G 0 100% / vmfs / vmhba0:1:7:1
    vmhba0:1:8:1 15 G 14 G 1.1 G 93% / vmfs / vmhba0:1:8:1
    vmhba0:1:9:1 63 63 G 0 100% / vmfs / vmhba0:1:9:1
    vmhba0:5:0:1 59 G 14 G 44 G 24% / vmfs / vmhba0:5:0:1
    vmhba0:6:3:1 29 G 14 G 14 G 49% / vmfs / vmhba0:6:3:1
    37 G 35 G 1.7 G 95% vmhba0:6:6:1 / vmfs / vmhba0:6:6:1
    vmhba0:7:0:1 499 G 450 G 49 G 90% / vmfs / vmhba0:7:0:1
    7.4 G 7.3 G 180 M 97% vmhba0:9:0:1 / vmfs / vmhba0:9:0:1
    37 G 36 G 1001 M 97% vmhba0:9:1:1 / vmfs / vmhba0:9:1:1
    vmhba0:9:3:1 G 7.4 7.4 G 0 100% / vmfs / vmhba0:9:3:1
    vmhba2:0:0:8 39 G 39 G 29 M 99% / vmfs / vmhba2:0:0:8
    [root@esx011 /] # df h
    Size of filesystem used Avail use % mounted on
    / dev/sda1 3.0 G 2.5 G 364 M 88%.
    / dev/sda3 15G 5.6 G 8.3 G 40% / images
    No 392M 392M 0 0% / dev/shm
    / dev/sda6 23% 424 M 1.4 G 2.0 G/var
    / dev/sda5 7.7 G 81 M 7.2 G 2% /vmadmin
    [root@nbxva011 /] # wwpn.pl
    vmhba0: 210000e08b1a51d3 (Qlogic) 5:4:0
    vmhba1: 210000e08b1a03d1 (Qlogic) 7:3:0
    [root@esx011 /] # cat /etc/lilo.conf
    command prompt
    Timeout = 50
    boot = / dev/sda
    install=/boot/boot.b
    linear
    default = esx

    image=/boot/vmlinuz-2.4.9-e.71smp
    label = linux
    root = / dev/sda1
    initrd=/boot/initrd-2.4.9-e.71smp.img
    read-only

    image=/boot/vmlinuz-2.4.9-e.71
    label = linux-up
    root = / dev/sda1
    initrd=/boot/initrd-2.4.9-e.71.img
    read-only

    image=/boot/vmlinuz-2.4.9-vmnix2
    label = esx
    root = / dev/sda1
    initrd=/boot/initrd-2.4.9-vmnix2.img
    read-only
    Append = "mem = 800M cpci = 0: *;" 1 : * ; 2 : * ; 3 : ; 4:5:0; 7:0; 9 : * ; 10:; 11:; 12: *; 14:; 15: *; 17:; 18: *; 20:; 21: *; 23:; 24: *; 26:; 27: *; 29:; »

    It's client server which I can not restart the server boot or HBA settings view.

    All points will be awarded.

    Thank you

    And in MUI - HBA is not shared with Service Console

  • How can I detect when the last container in my stream is full?

    I have a bunch of related containers which I am flowing text through. How can I detect when the text has filled a container? There's an overflowPolicy then I guess it can be detected.

    Hello

    I used this:

    private function IsOverset(textFlow:TextFlow):Boolean

    {

    var zeComposer:IFlowComposer = textFlow.flowComposer;

    var iTextLen:int = textFlow.textLength;

    var iNoController:int = zeComposer.findControllerIndexAtPosition (iTextLen - 1);

    return (iNoController is-1);

    }

    HTH,

    J.

  • How can I get off the annoying ads for Apple music for good?

    How can I get off the annoying ads for Apple music for good?

    Settings-> music-> see music from Apple (off)

    Does that help?

  • I delete an email, how can I remove it & the sender of a search?

    I delete an email, how can I remove it & the sender of a search?

    I assume you mean global search. If this does not work, you can rebuild its search-db

    https://support.Mozilla.org/en-us/KB/rebuilding-global-database

  • How can I find all the plugins in the firefox browser

    HI I was wondering if I could ask a question how can I find all the installed plugins in the firefox lasted I would like to be able to know if, for example, if the shockwave plugin is updated and which version is currently installed in the firefox browser lasted.

    Thank you

    Hello Funny78, type Subject: addons in the address bar and then select plugins, add-ons manager opens and you can see the last version of the plugins (and other info), now click on the click to see if your plugins are up to date and see if it is.

    Thank you

  • I use the beta version, how can I return to the basis of Firefox?

    How can I return to the basis of Firefox instead of the beta?

    Backup of your profile and you will not lose your add-ons and bookmarks.

  • How can I enter in the Gallery of photos iPhone 6s

    How can I enter in the Gallery of photos iPhone 6s? Like the ones you see on banners or commercials. Thank you

    If you mean the shooting on the campaign of the iPhone, you have not. If Apple sees your work and think it would be a good fit, they as you approach. So, better than you can do is put your work out there on things like Instagram.

    otograph https://photographicpunctuation.com/2015/03/07/The-Story-of-My-Shot-on-iPhone-pH.

  • How can I transfer only the music I want?

    Hello.

    Our iMac iTunes is full of music for the whole family. How can I transfer only the songs I want on my iPod and my iPad?

    Second...

    When connecting from my iPad to my iMac USB cable the iPad goes into sync mode and transfers all sorts of things on the iMac and gets things from him. All I want is to transfer my music? How can I do this?

    Create your own playlists in iTunes.

    Connect your iDevice to the iMac - in the main iTunes window select your iDevice - menu drop-down upper left box located to the left of the music-movies, etc.

    You will see a list of 'Settings' for this device - select a tab and check the boxes of what content you want on your device.

    Also in the Group of settings select 'Summary' - from there, in the 'Options' section, you have a few additional items to choose from.

    MJ

  • I have a partitura with 18 instruments. Problem is that only 16 of the sheed. How can I vertically down the music?

    I have a partitura with 18 instruments. Problem is that only 16 of the sheed. How can I vertically down the music?

    Make a score set with 18 all instruments. Then use the scale parameter set score to all fit on a single page.

  • Stolen phone. How can I check when the last time saved my phone to my laptop (without my iphone of course)?

    My iPhone was stolen. How can I check when the last time that I backed up my phone to my laptop without my iPhone?

    Click here and either use iTunes to check or browse to the path of the backup manually.

    (142338)

  • Inability to RESUME download in ffox - how can you see if the server supports resume for example all filehosts

    HI: I tried to dl from filepost (260 file size) and sometimes it stops at 240.
    I tried the answer in support of "fake resume:
    https://support.Mozilla.org/en-us/questions/672203?ESAB=a & As = AAQ

    It did not work.
    How can I test if the site allows you to resume?

    or I need to test for a specific file on the filehost to resume?

    Thank you

    Hi Cor - el
    I found Opera. Opera browser does not compare to the greatness of firefox. Or help their support forums.

    But Opera a button BACK on their download window.
    The thing with the opera, is to open the download manager in a new window and make it look to Firefox Add-on like big DownloadManager Tweak.

    Then, he looks the same, so that you know what you're doing
    AND it has a download / RESUME button

    for info:

    > I tried Opera download on all those failed (try the rename delicate) Opera RESUMED in all cases test 9

    > and where I could not firefox to resume, not once in all the test cases 9.

    so my conclusion is the workaround is not very good. And it had nothing to do with the server, I was downloaiding of (in test these 9 cases)

    Perhaps in a future version:-firefox may also have the wonderful resume button and the Add on Download Manager TWEAK, may also have the CV download button.

Maybe you are looking for

  • Airport Express has stopped working after a reboot?

    My internet is slow so I disconnected all my gear to restart, and subsequently, my Airport Express flashes orange and doesn't seem to work. It is used as an Extender for internet and wireless printing. The Internet access does not work in the room in

  • Is it possible to run Windows 7 on Tecra S1 PT831E

    Hello is it possible to run Windows 7 on my Tecra S1 PT831E 126PQ? I've updated the BIOS (last?) version 2.50 (it should be suitable also for Windows 7). With this done BIOS is fully compliant with ACPI? Checking with Windows 7 Upgrade Advisor should

  • HP 7550 has: can't I just install 1 black basket in a hp 7500 has

    AS the subject of the dispute.   I do not use this printer for printing just for the multifeuille scan ability and outgoing fax etc.   The carts are empty for centuries.   Everything was fine until someone removed the empty carts and now mc boots up

  • Connection through another linksys router E1200

    How can I configure my e1200 to work through another router linksys (e2500).  Right now, he is only 90% of the way through the implementation

  • FDMEE export to HFM fails

    Hi team,I get the error message below when you validate the option in FDMEE with HFM. Same problem happens if I export to HFM, the HFMValidate and HFMExport scripts are not get initialized.Even the fish don't get not gray out to show an error. Please