Flex - HTTPPoller

TAGS: None

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

Flex - IdleManager

TAGS: None

This is an Idle manager built for flex that allows you to automate events when your application has gone idle for a specified amount of time.  I recently found out this IdleManager was in use in the NFL video player.

It allows you to -

  • Add a recurring event that fires ever N number of milliseconds when the app goes idle
  • Add a one time idle event that fires one time the next time the application goes idle and reaches that number of milliseconds - then delete the listener
  • Add an event that will be fired one time every time the application goes idle and reaches that number of milliseconds

USAGE

private function initIdleListeners():void{
//you can pass an optional data object to any of these methods that will be passed with the event
IdleManager.getInstance().addFirstTimeIdleEventListener(1000, firstTimeHandler);
IdleManager.getInstance().addOneTimeIdleEventListener(3000, oneTimeHandler);
IdleManager.getInstance().addRecurringIdleEventListener(5000, recurringHandler);
}
 
private function firstTimeHandler(e:IdleEvent):void{
trace('This is fired every time the app idles for the specified amount of time, just ONCE');
trace(e.millisecondsIdle, e.type, e.data);
}
 
private function oneTimeHandler(e:IdleEvent):void{
trace('This is fired exactly once, the first time the app ever goes idle for the specified amount of time, then is deleted');
trace(e.millisecondsIdle, e.type, e.data);
}
 
private function recurringHandler(e:IdleEvent):void{
trace('This is fired recurringly every time the app goes idle for the specified amount of time');
trace(e.millisecondsIdle, e.type, e.data);
}

You can view the source HERE

Please leave any comments or questions below.

Thanks

MLB

TAGS: None

mlblogo.jpg

As of yesterday appDivision was engaged by MLB to take part in the development of their subscription video player.

MLB recently opted to deliver their video content through the flash player which has a significantly higher penetration than Silverlight, which MLB had previously partnered with.  It is interesting that we happened upon this gig due to the fact that both Nick and I were at the Adobe Max keynote where the Adobe/MLB partnership was announced.

I personally am excited to be working on this project, and can't wait to see the final product.