Dispatching Events with Cairngorm 2.2.1

While trawling through the CairngormEvent.as I noticed the distpatch() method which in essence calls the same code that was needed in the previous versions of Cairngorm.

Pre Cairngorm 2.2 example

view plain print about
1var userVO : UserVO = ModelLocator.getInstance().userVO;
2var event : LoginChangeEvent = new LoginChangeEvent(LoginChangeEvent.LOGOUT_EVENT,userVO);
3                
4/* dispatch the event */
5CairngormEventDispatcher.getInstance().dispatchEvent( event );

Latest example

view plain print about
1var userVO : UserVO = ModelLocator.getInstance().userVO;
2var event : LoginChangeEvent = new LoginChangeEvent(LoginChangeEvent.LOGOUT_EVENT,userVO);
3                
4/* dispatch the event */
5event.dispatch();

It just saves having to import the CairngormEventDispatcher and typing those extra characters. Which can save a lot of time if you're a chicken pecker typist :)

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.6.004. Contact Blog Owner