Flex - HTTPPoller

This class lets you dynamically add polling mechanisms to your application.  You interface with the class statically.

This works ideally within a cairngorm application as you pass a class method, and responder (implements IResponder) when adding an HTTPPoll.  The responder is automatically passed into the constructor of the class you pass the method.
From there you can statically pause polling by id, start polling by id, also pause and start all active pollings.

USAGE - this particular example is cairngorm specific.

override public function execute(event:CairngormEvent):void
{
    super.execute(event);
 
    HttpPoller.addHTTPPoll(UIDUtil.createUID(), 3000, Delegate, 'delegateMethod', [array, of, arguments] this, true);
 
    // @param - id to access the poll with,
    // @param - time in milliseconds between polls
    // @param - class on which to call method
    // @param - method on the class to call
    // @param - array of arguments to pass this method
    // @param - the responder which the http service will call back to,
    // @param - boolean, whether or not to start the polling immediately.
}

You can download the source HERE

Feel free to leave any comments or questions below

Thanks

TAGS: None

Leave a Reply