Aug
19

2

Nullable Boolean

Strange I find myself writing about the primative, Boolean. Its a primative, why would you ask any more of it? As it stands, the Boolean has two states; true and false. On more than one accasion I have needed boolean to support one more value; null. Lets suppose you have a form and you want users to complete it. If the user has not answered a true / false question, null is a valid value. You can not suppose that unaswered questions are false. Let me present to you the NullableBoolean. Instead of using the variable name to compare against, you use the ‘value’ field. By adding a ‘value’ field I am able to make the object answer true / false / null. Please see the full article for the source code and example usage.

Happy Coding

Full article...

May
31

2

Dragging and Dropping new windows from an AIR application

Drag and drop new windows from an AIR application.

Recently I was tasked with writing an AIR application that had tear-off windows. The more I tried to use the DragManager and the NativeDragManager, the more frustrated I became. For the reasons outlined below, I was forced to come up with a custom dragging solution to get the proper tear-off behavior.

Adobe’s AIR and Flex support drag-and-drop through the use of two drag drop managers; the DragManager (supported in Flex and AIR) and the NativeDragManager (supported in AIR). What isn’t well documented is the various flavors of drag-and-drop these managers can enable. I am going to discuss three of those flavors. The first and most common is intra-application drag and drop - this method can be used in Flex and AIR. The next two methods are AIR-only: IO-based and tear-off.

This sample AIR app demonstrates each of the three behaviors.

Full article...

May
27

1

Cairngorm - 4 Delegates and the ServiceLocator

In the previous tutorial we covered how the FrontController and its mappings to Command  classes allow applications to encapsulate discreet tasks in one place. Building upon that theory we are going to explore two major concepts in this tutorial. The first is the use of a delegate which employs a ServiceLocator and a dataservice. The second major concept to be covered is the extension of our Command classes to implement Iresponder.

Full article...

May
13

Cairngorm - 3 Commands

In the previous tutorial we covered CairngormEvents. With their Publish/Subscribe model event dispatchers, we were able to communicate directly with event handlers (more or less). In this tutorial, we are going to build upon how Cairngorm handles events. As in the last tutorial, we will be using the CairngormEventDispatcher to dispatch events. We are still free to use the Cairngorm EventDispatcher to listen to events, but this time we won’t. Cairngorm provides the FrontController to map specific events to specific Command classes. As we did before, we are able to assign multiple handlers to a single event.

Full article...

May
06

1

Cairngorm - 2 Events

In the previous tutorial we covered the use of the ModelLocator and showed how it can be used to decouple a tightly bound application. Here we are going to cover the Cairngorm event model. Flex uses a Bubble/Capture event model which has some limitations. The biggest drawback is that you can only listen to events fired by your children and their descendants. Cairngorm provides a Publish/Subscribe model that lets you further decouple your application. Let’s say you you have a menu in a navigation bar on the left side of your application and another menu in another navigation bar on the right side of your application. Let’s further suppose that those two menus each need to know the state of the other. In native Flex, the highest common parent would need to listen for events thrown from each menu, capture those events and, as in the example presented in the last tutorial, pass the event data back down the chain on the other side. We just decoupled this type of binding for data, and now we find it emerging again for events. Events are fleeting and it seems a bit much to declare every event as a property on our model. So let’s use the CairngormEventDispatcher to get us around this problem.

Full article...

Page 1 of 2 pages  1 2 >