Ryan Campbell Flex/Flash Developer Blog

12Mar/083

OpenFlux Example: Deck of Cards

By now I'm sure a lot of you have heard about Ben Stucki's latest project called OpenFlux. If not, check out the blog entry Ben wrote introducing it or listen to the latest The Flex Show episode discussing it.

I'm really excited for OpenFlux, have been contributing to the project quite a bit and I'm hoping to spend a lot more of time over the next while helping get OpenFlux to a stable release and posting examples on my blog so others understand what's possible.

The general difference between an OpenFlux component and the current Flex components is that the logic is separated in to a MVC architecture. This allows you to easily swap out one part of a component while keeping the functionality of the others. A List component goes a step further and separates the layout logic so you can easily invent new ways to layout your list items.

In this example I've created a cool (but possibly not too practical) OpenFlux List component that displays a deck of cards. Although it looks nothing like a standard List component, it is a List and has the same functionality that you would expect a List to have. For example, the cards are selectable and as you select multiple cards their suit/rank is displayed in a separate standard List.

To get the List working how I wanted all I had to do was use the Image component as my item renderer and create a custom layout class (which is now included with OpenFlux, called StackLayout). The StackLayout has gap and selectMode properties that you can play around with. Click the image below to try the working example.

picture-1.png

You can checkout the latest OpenFlux source code, including code for the example, at the OpenFlux SVN webpage.

Filed under: Flex, OpenFlux Leave a comment
Comments (3) Trackbacks (1)
  1. I just found out about OpenFlux myself and I think the idea is great. Today I’ve started playing with it myself. I’m trying to create a Chart model with a starting view of ChartColumn, but later I will add a ChartLine and ChartPie probably.

  2. Hi,
    I have a doubt regarding stacklayout, I need an example for practice.so,If you have any will you please send to my mail please .

    For codders it was very useful. GOOD

    Thanks & Regards,
    Pavankumar

  3. Hi,

    i am getting some pro while i am using this SWC in my application please send me source code then i can fix this issue.

    Thanks & Regards,
    Ranadheer.


Leave a comment


Ryan Campbell


follow bobjim at http://twitter.com

Recent Posts

Categories

Archives