From the “don’t-beat-your-head-against-the-same-wall” department: Here’s the original situation:

1. .NET class (MyContainerType) with a public List<MyChildType> Data { get; set; }

2. Flex has both IMyContainerType and IMyChildType and their corresponding value object classes.

3. Both deserialize properly when service method calls return either class directly, but NOT the MyChildType objects in the Data property of MyContainerType; they return as simple AS3 Objects.

The problem is that unless you refer to the class “MyChildType” somewhere in your project, the Flash runtime has no idea that the “MyChildType” exists. Typically, you’d refer to this class in a view or something, so this problem is very esoteric and you most likely won’t encounter it, but if you do, keep this in mind.

The safest thing you can do is mention the class you intend for your ArrayCollection to contain in your value object (in lieu of Flex Generics) as follows:

AS3 ArrayCollection "Generic"

Ensure that the compiler includes the Class that the ArrayCollection will contain.

First, click here to view a quick demo of the problem. (Source here). When the lists load, roll over one of the items labeled “something” and notice the hover behavior.

The problem is, that these Lists are bound to and Array and an ArrayCollection of Strings (which are immutable in AS3). Likewise, if multiple entries in an Array referenced the same object, the same issue would occur.

This is a particularly annoying implementation challenge, where you might commonly want to bind an Array of String to a List. This may or may not actually be a bug–well it might be, in that the requirement for uniqueness in dataProviders isn’t very well documented–but it is consistent with how Arrays work in AS3. If you have two strings in an ArrayCollection, for example, the only way to retrieve a particular value is to do so by index; you cannot call .getItem(“stringvalue”) because the collection has no idea which one you are referring to.

The workaround is either to wrap each item in a new object, such that [{label: "string value"}, {label: "string value"}] so that each object actually exists as a unique object in memory, or to wrap ArrayCollection so that it recognizes primitives and wraps them automatically.

This “bug” is being tracked here: https://bugs.adobe.com/jira/browse/SDK-17182 reported by Albert Chang.

This effect was brought to my attention by Winton De Shong.

HydraMVC has become a part of HydraFramework. The source is on http://github.com/lukesh and you can read more about the framework at http://hydraframework.com. More later!

Want to growl in your Flex apps? Try this junk. FlexGrowl is a component that allows you to create growl-like notifications in your Flex apps. If you don’t know, Growl is an integrated notification system for OSX that listens for notifications from registered applications. It looks like this:

FlexGrowl implements this type of interface for Flex; it looks like this (click here for working demo):

However, you can customize the growl notifications to look however you’d like. The notifications shown above are created with Degrafa (which, by the way, is awesome). Click here to download the source. Let me know what you think!

HydraMVC.com Screenshot…And it seems to be the magic number for now. I’ve been using this version for a while and it seems stable and complete enough to actually use f’real. If you don’t know what it is, click here to read about it and get it.

Besides all the obvious goals for HydraMVC (read about them on the website), I have a few big plans for the framework. Firstly, I’d absolutely love to get an AIR debug console written for it. I just ran across this gem today, which is pretty close to what I would like to develop for Hydra, except that instead of debugging the AS3 code per se, it would debug the application logic of the MVC by trapping the paths of Notifications as they are handled by the various actors in the MVC. Since De MonsterDebugger is open source, there’s nothing preventing me from actually augmenting it with a HydraMVC debug console. Talk about pure hotness. Anyway, with deadlines (seriously) looming, don’t look for this anytime this month. But it will happen. Mark my words.

Secondly, something that would also be wonderful if it was integrated with a debug console would be a unit testing interface. That’s all I’m gonna say. See, the beauty of it is that we could just compile out two HydraMVC SWC’s–a debug version and a production version. The debug version would provide the hooks for the debugger and the production version would bypass them. Then, when you’re ready to deploy a HydraMVC application, just switch SWC’s. I wonder if we could even make this a compiler directive for a single SWC? Hmm… Anyway, I’m super excited. This framework is not only pretty cool as-is, but represents to me a ton of realizable potential that would really provide a very accessible, learnable, structured way to develop medium to large, scalable, debuggable Flex applications. Stay tuned. Download HydraMVC and let me know what you think.

I think I have a decent workaround to this old bug, where you run into formatting problems if you want to use a custom borderSkin on a Panel or Alert. (I especially wanted to use a skin created with Degrafa.) In addition, I wanted to set up something where I could create a generic Panel skin to use throughout my application, but also use the skin for Alerts without it messing up the title bar. Even though it’s over a year old, this post is still getting remarks about the layout bug. 

Admittedly, my workaround is a total hack. However, that’s why it’s called a workaround. I’ve been using it without issues, and wanted to make it public. Click here to download a Flex project archive with the solution files. This is what it looks like:

 

Custom Panel / Alert Skin

Custom Panel / Alert Skin

Some really interesting things are happening at andCulture these days. In addition to rocking the CSS/HTML/jQuery/AJAX suite of technologies, we’re building libraries for Flex like never before–using Flex for both back-end application-y RIA software and also as the framework for very rich UIs that look nothing like an app.

We’ve been consuming data from .NET, both SOAP and AMF, and from PHP via AMFPHP. Jason Kichline (@jkichline) has been doing some really interesting things with building abstraction classes in a project codenamed SudzC (SOAP classes for Obj-C / iPhone).

For most (ok, basically all) of our Flex projects we use PureMVC, which is elegant, language agnostic, and quite minimal. However, it’s not without its drawbacks. Being language agnostic is nice when you want to develop for multiple platforms and not have to switch out your paradigm-parser, but not so hot when you actually want to take advantage of a platform’s stuff–like for instance, Flex’s event model. PureMVC rolls their own Observer pattern, which is really nerdy and wot not, but sometimes, you just want to use event bubbling / capture. And not have to implement Pipes.

Another interesting challenge of extracting a framework is finding the balance of modularity in encapsulation, and ease of use, so your team can actually build stuff quickly with it. For instance, we’ve got some solid application logic in our MVC, but you might want to switch out where the data actually comes from and not have to trust the developer to ensure that the Notifications are all where they need to be.

Screengrab showing basic package structure of AdeptivMVC

Screengrab showing basic package structure of AdeptivMVC

Our answer was kind of a crazy synthesis of a solution for each of these problems. First, we wrote a Plugin / Provider methodology for our framework, not unlike the Provider metaphor in .NET. So, our Model (Proxies) tell the data where to *go*, and *how* it interacts with the application, but Providers interact with the Proxies to actually *get* the data. Pretty nifty. Oh, and while we were at it, we kinda just rewrote PureMVC.

We’ll see if it works out. Basically, you know those times where if you have to trip over that creaky stair *one more time* you’re going to go totally ape and remodel the entire downstairs? That’s exactly what happened.

My mission was to take out all the annoying things about PureMVC and keep all the cool things. Kinda like Palm did with Pre and the iPhone.

Testing it basically involved taking an existing PMVC application and seeing A. how difficult it was to retrofit the new framework and, B. make sure it still works. So far, retrofitting the “AdeptivMVC”, as I’m calling it, is totally easy to do, and regression testing seems to prove that stuff still works.

Now, we also get the added niceties of being able to use Singleton proxies if you want, and have multiple observers in a many-to-many relationship within the app. I added a “Relay” pattern in the mix verus the Multion thing that is used in PMVC, which basically makes things a hierarchy which allows for some neat event bubbling tricks.

I’ll try to get some demos and things up, maybe work on the Adeptiv framework initiative on adeptiv.com, and maybe even have some time to sleep in between doing billable work! Afterburners, engage.

Warning–non tech-related, quasi-philosophical, meta-existential, blah blah, so read at your own risk. Subtitled, need to write a technology post so this gets off my home page.

I can’t sleep. I’m kept awake by a series of haunting revelations in the form of what I can only describe as “the right questions” that seem to explain the nature of life and reality in a profound juxtaposition of perfect clarity and haunting mystery.

We all die. All of us must wrestle and come to terms with the fundamental mysteries of reality. Whether you call it philosophy or religion, something needs to click into place inside our brains–a framework on which we can use to reconcile what seems to be the ultimate futility of life itself as the years blow by with such callous speed.

What is life, anyway? Why do we consider the concept of our individual lives to be fundamentally equal to our conscious mind?

We say that a fire dies. Is the life of the fire it’s own existence, or is it more deeply, the consuming of the wood, and the eminence of heat and light? I tremble as I think about it! We clench our consciousness as if it were the essence of life! Somehow we are so afraid to lose it, that if we die, go into the ground, lose our ability to traverse through time, feel, interact, reason–that we DIE. Is that death!? Maybe not!

Our bodies are just husks–sublime, mechanical devices that burn food. So are our brains, our minds, and our consciousnesses, that was born at a period of time, lives through periods of time, and will at a period of time, die. Does the fact that we die at one period of time negate the fact that we are alive at another?! If the nature of our existence transcends time, when the time comes that we die, are we not still alive?! (That is, we are no longer conscious, but our existence has been etched into the fabric of space-time!) Our choices forever impact the universe, and CANNOT BE REVERSED.

We, dead, are a four-dimensional being, a being who’s existence simply IS. Life now is a process of growing that being. Our growth is complete when we die. Then we exist.

When a fire dies, the heat and light it emits exist, and have permanent impact. The life of the flame is not defined essentially by its own self-awareness.

Eternal life–what is it? Jesus defines it as simply, “knowing God”. Does this confuse you?! How can I hear this and not feel the uncanny mystery of this truth at the core of my assumptions about reality? Life, is simply knowing God? This begs a redefinition of the very word, meaning, and nature of life itself.

What is consciousness? Why is it so important to us? Self-awareness, reason, memories. We somehow place our identities in how we feel and what makes us laugh. What gives us the framework to do this? It’s as if a flame would base its value on some obscure properties of its existence rather than the heat and light it emits, is it not!? So we die and are no longer conscious in time. What does it matter?! We say that we “have lived”–can we not say at the moment of death, “I now LIVE”?! I have completed my growth through time, and I now EXIST?! Is not this four-dimensional being of our lives not OUR VERY SOUL?!

I move to separate the seemingly fundamental equality of the terms life, consciousness, identity, and soul.

I move to think of time as it is–equal in dimensional tangibility as height, width and depth. We can only see a slice of time at once with our current faculties, and this limitation is the construct of what we so dearly cling to as “consciousness”.

Our choices are IRREVOCABLE. They have such a profound impact on our identity! If we make a choice yesterday, and it’s a bad one, we shake it off, and say, “well, I’m a new man today”–as if our identity is limited to this slice of time. If every day is a ring that we stack on a post, unique in size and shape, at the end of our lives we will see a sculpture of individual identity.

We are fluid beings, and can only grow and change so much in each slice of time–like a fire rapidly changes shape, but slowly grows from a small flame, to a giant bonfire, to embers, to ashes. We are instructed to daily “renew our minds.” This terminology is just adequate. Every immeasurable slice of time that passes, not only do our thoughts and choices define what we think in the next slice, but they are building and growing what someday will define us as our identity. Our consciousness thereof is questionable as we define consciousness.

I laugh inside when religions define the afterlife so neatly wrapped–”oh, I’ll see them in Heaven”. YOU HAVE NOT A CLUE how you will see, if you will see, what you will see. I’m sure even more today than ever that the book of Revelation is more profound truth than we can attempt to rationally deserialize from the “three-dimensionally-flattened” view of John’s revelations. It’s like flatting a three-dimensional object to a two-dimensional drawing and attempting to examine it’s backside.

Whether you ascribe to a theistic or non-theistic world view, you must come to reconcile life in the contexts of origin, meaning, purpose and destiny. The questions of consciousness, ethics, and what happens after you die simply must be addressed. I say this, because even if you can somehow brush them off now as if you don’t care, you will care sooner or later. I’m not saying all this to proselytize, or to “save you”–this is simply a self-serving act of somehow attempting to articulate the rage inside! Tonight feels like the culmination of years of thought to me, so inadequately expressed, yet, to me, life-defining. Even if you don’t believe in God, think of the wonder of the ability to transcend time and experience the essence of the dimension of time all at once–what it must look like. The timelines of all the men and women of history, their interaction, your life–all visible at once as a sculpture entitled “humankind”.

Disease:

“Programming In Spite Of Flex Framework syndrome” – A.k.a “PISOFF”, pronounced “pissoff”: A serious project-life-threatening disease that often goes undetected until it is too late. Occurs most frequently in the first few projects of a novice Flex developer, however rare cases can occur in intermediate to advanced Flex developers. In almost all cases, victims are intelligent, experienced programmers who are transitioning to Flex from other development environments that they have been proficient in.

Symptoms:

  1. Code bloat
  2. “Freaky” problems (i.e. UI flickers / inconsistencies)
  3. Maintainability / transference problems
  4. Inconsistent methodology
  5. Inconsistent user interface standards
  6. Lack of encapsulation / code reuse
  7. Increased development time
  8. The feeling of “this has got to be easier”
     
Causes:
  1. Lack of knowledge and practiced skill of using and properly appropriating the tools available in a given framework.
  2. The attitude that the learning curve vs. benefit of learning and appropriating the components of the Flex framework is too steep and the benefit too little.
  3. Not enough time to learn the framework, but up against a deadline to produce a project in the framework.
  4. Typically intelligent, experienced programmers will tend to draw similes like “oh X in Flex is just like Y in _____” and miss out on paradigms that are introduced in Flex that may not have a direct correlation in another language or appropriate best practices in another language that aren’t necessarily best practices in Flex.
     
Remedy:
  1. Place a priority in learning the framework and not just the minimum to draw something on the screen.
  2. Make resources and practice material available.
  3. Be willing to prioritize and accept that code will need to be refactored until you become really skilled in the framework.
     
Rehab:
  1. Unfortunately, existing code will need to be refactored. It’s tempting to say “it just works, so let’s leave it alone”, but not only will refactoring the code ensure that it is executed properly, but it will also provide a learning opportunity.
  2. Timelines on existing and future projects will need to be adjusted to accommodate the required learning.
     
Prevention:
  1. Recognize that with every new framework, the risk of PISOFF exists, and that it can sneak up on you and bite you in the tail if you don’t preempt it, even if you consider yourself an advanced developer.
  2. Don’t undervalue small exercise projects that exist only to learn what the framework provides.
  3. Educate all developers about the risks, causes, and prevention of PISOFF.
     
I don’t want to be silly in presenting this as a disease. We need to label it and treat it like one; or, just like other diseases and disorders, you just brush it under the rug until you find yourself in a pine box. It’s not convenient, and it may not be immediately apparent if you aren’t aware of its existence, but it’s real and it’s deadly, and your project might have it.

Screenshot

This weekend I threw together an algo to generate Aurora for a holiday ecard. I was really happy with the outcome. You can see the card here.